REACT Flashcards
What is JSX?
a syntax extension to JavaScript used with React to describe what the UI should look like
Why must the React object be imported when authoring JSX in a module?
JSX is just syntactic sugar for react elements and depend on the React.createElement method.
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
add the babel-loader to the list of modules in the webpack config obj
What is a React component?
a single section of the UI represented as a JS function that returns React elements
How do you define a function component in React?
just like a regular JS function: Must be capitalized. function Name(props){ }
How do you mount a component to the DOM?
ReactDOM.render(, root);
What are props in React?
props is the property object which holds property values of that React element
How do you pass props to a component?
specify the prop name = “property”
ex)
How do you write JavaScript expressions in JSX?
use curly braces {props.text}