React Components

What is a React.Component?

Ex. of HTML created by this added to the DOM:

App is the Top-Level Component

class App extends React.Component {
render() {
return (
<div>
<Book />
<Another_Component />
</div>
)
}
}

Import Child(ren) Components into your Parent Component.

If exporting default class…(allowing it to be imported by another file.)

If exporting a “named” component (not default ) add {} around the class you’re importing like so:a “named” component

import Book from './Book';
import {Another_Component} from './Another_Component';
class App extends React.Component {
render() {
return (
<div>
<Book />
<Another_Component />
</div>
)
}
}

--

--

--

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

React Hooks — Creating Custom Hooks

UNDERSTANDING THE “THIS” KEYWORD IN JAVASCRIPT

Create a beautiful tabs using Contrast

To find mid point of Linked list

Why I Always Use Shallow Rendering

How to change the speed of a Facebook video

Great articles & Exciting news from Kt. Academy ⭐️

Day 12: Local development server for Lightning Web Components

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Rumiko Acopa

Rumiko Acopa

More from Medium

Components In React

React JS / Components , props and state