react-elements Flashcards

1
Q

What is React?

A

A JS library for building user interfaces. Efficiently updates and renders the right components based on state. Encapsulated components that manage their own state. Works on Node and can make mobile apps with React Native.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is a React element?

A

The smallest building blocks of React apps. They describe what you want to see on the screen written in XML and HTML. They are plain objects that are cheap to create and immutable meaning once it is made you cannot change its children or attributes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you mount a React element to the DOM?

A
  1. Query the DOM for a div with id root which you put inside the body and save it to a const variable (container)
  2. Call the method ReactDOM.createRoot(container) with the DOM element with id root.
  3. Assign the return of the above method to a const variable (root)
  4. Call the method React.createElement(type, optional props, text content or children)
  5. Assign the return of the above method to a const variable (el)
  6. Call the method root.render(el) where root is from step 3, and el is from step 5
How well did you know this?
1
Not at all
2
3
4
5
Perfectly