Code React Sweetly
/
Components
Components
https://leanpub.com/code-react-sweetly
Syntax of a React component
https://leanpub.com/code-react-sweetly
What Exactly Are Props in React?
https://leanpub.com/code-react-sweetly
How to Invoke React Components
https://leanpub.com/code-react-sweetly
Invoking components without props
https://leanpub.com/code-react-sweetly
Invoking components with props
https://leanpub.com/code-react-sweetly
Invoking components with nested content
https://leanpub.com/code-react-sweetly
Invoking components with variables
https://leanpub.com/code-react-sweetly
Invoking components with the dot notation
https://leanpub.com/code-react-sweetly
How to Display a Component Inside a Browser’s DOM Node
https://leanpub.com/code-react-sweetly
1. Create a new
ReactDOMRoot
object instance
https://leanpub.com/code-react-sweetly
2. Display your component inside the
root
object instance
https://leanpub.com/code-react-sweetly
3. Enable strict mode
https://leanpub.com/code-react-sweetly
Important Things to Know About React Components
https://leanpub.com/code-react-sweetly
1. Use the Pascal case naming convention for your components
https://leanpub.com/code-react-sweetly
React component tag example
https://leanpub.com/code-react-sweetly
HTML component tag example
https://leanpub.com/code-react-sweetly
2. Bracket notation expressions do not work as React component tags
https://leanpub.com/code-react-sweetly
3. Bracket notation expressions in variables work as React component tags
https://leanpub.com/code-react-sweetly
4. Make your components pure
https://leanpub.com/code-react-sweetly
Example 1: Impure React component
https://leanpub.com/code-react-sweetly
Example 2: Pure React component
https://leanpub.com/code-react-sweetly
5. Define components at your file’s top level
https://leanpub.com/code-react-sweetly
Creating Reusable React Components
https://leanpub.com/code-react-sweetly
The issue with rigid components
https://leanpub.com/code-react-sweetly
How to split rigid components into reusable chunks
https://leanpub.com/code-react-sweetly
1. Create a new project directory
https://leanpub.com/code-react-sweetly
2. Install React and ReactDOM
https://leanpub.com/code-react-sweetly
3. Create the web page
https://leanpub.com/code-react-sweetly
4. Create the BlogPost component
https://leanpub.com/code-react-sweetly
5. Create the Header component
https://leanpub.com/code-react-sweetly
6. Create the FeaturedImage component
https://leanpub.com/code-react-sweetly
7. Create the Post component
https://leanpub.com/code-react-sweetly
8. Import your extracted components into the BlogPost.js file
https://leanpub.com/code-react-sweetly
9. Run your application
https://leanpub.com/code-react-sweetly
Tips on creating reusable React components
https://leanpub.com/code-react-sweetly
Time to Practice with Components
https://leanpub.com/code-react-sweetly
How did you create your checkboxes?
https://leanpub.com/code-react-sweetly
1. Create a new project directory
https://leanpub.com/code-react-sweetly
2. Install React and ReactDOM
https://leanpub.com/code-react-sweetly
3. Create the web page
https://leanpub.com/code-react-sweetly
4. Create a components directory
https://leanpub.com/code-react-sweetly
5. Create the Checkbox component
https://leanpub.com/code-react-sweetly
6. Create the root component
https://leanpub.com/code-react-sweetly
7. Create the entry script
https://leanpub.com/code-react-sweetly
8. Run your application
https://leanpub.com/code-react-sweetly
The checkbox app without reusable components
https://leanpub.com/code-react-sweetly
Up next
Rendering Lists of Elements from an Array
In this chapter
Components
Syntax of a React component
What Exactly Are Props in React?
How to Invoke React Components
How to Display a Component Inside a Browser’s DOM Node
Important Things to Know About React Components
Creating Reusable React Components
Time to Practice with Components