React.js Flashcards
What is React?
A JavaScript library for building user interfaces
What is a React element?
smallest building blocks of react - also describes what the DOM should look like
How do you mount a React element to the DOM?
using ReactDOM.render()
What is JSX (JavaScript XML)?
A syntax extension to JavaScript that provides a way to structure component rendering using syntax familiar to many developers
Why must React object be imported when authoring JSX in a module?
Importing React is necessary because Babel compiles JSX down to React.createElement() calls
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
Webpack will allow babel loader to identify JSX needs to compiled and you can use Babel loader to compile JSX and transform JSX plug-in is necessary for babel to know
What is a React component?
review again - React component is sth
How do you define a function component in React?
function with a return statement like JavaScript function definition
How do you mount a component to the DOM?
Using ReactDOM.render(, document.querySelector(‘#id’));
What are props in React?
review again - Props are properties that are basically kind of global variable or object
How do you pass props to a component?
review again - component name key = string or javascript expression
How do you write JavaScript expressions in JSX?
curly braces
How do you create “class” component in React?
with keyword class className extends keyword React.Component with render() method
How do you access props in a class component?
use this keyword
What is the purpose of state in React?
State is an object that determines how that component renders and behaves