React Flashcards
What is React?
a JS library for building UI
What is a react element?
Object
How do you mount a React element to the DOM
Query select the element to attach it too, createRoot method and then the render method.
What is Babel?
- A javascript compiler, takes new JS to convert it backwards.
What is a plug in?
- An add-on that adds a special feature to a program
- What is a Webpack loader?
- Transformations applied to the source code of a module
How to make Babel and Webpack work together
By using webpack, babel and babel-loader to link the two.
What is JSX?
JSX is a syntax extension to JS, it produces react elements
why must the React object be imported when authoring JSX in a module?
Because the compiled output calls react.createElement()
how can you make webpack and Babel work together to convert JSX into valid JS?
Babel loader and the transform-react-jsx plug in
what is a react component?
Components let you split the UI into independent, reusable pieces and think about each piece in isolation
how do you define a function component in React
start with a capital letter, optional props parameter, it has to return react element.
How do you mount a component to the DOM?
Create a react element from a component and pass it to the render method of the root object.
what are props in React?
Object properties used to pass data from one component to another
How do you pass props to a component?
Type the react element, type the props which look like attributes, if its not a string use curly brackets