React.js Flashcards
What is React?
React is a JavaScript library and is intended to provide a simpler way to do ui
What is a React element?
smallest building block of React apps; they are plain objects and cheap to create
React Dom takes care of updating the DOM to match the React elements
How do you mount a React element to the DOM?
use ReactDOM.render to mount a React element to a dom element
What is JSX?
Syntactical sugar for react
Why must the React object be imported when authoring JSX in a module?
JSX is not really JS but Syntactical sugar for react
How can you make Webpack and Babel work together to convert JSX into valid JS?
install the babel plugin for transform react JSX
What is a React component?
a class or function that returns React elements
How do you define a function component in React?
use class or function and use jsx
function Welcome(props) { return jsxtag; }
or
class Welcome extends React.Component{ render() { return someTag } }
How do you mount a component to the DOM?
ReactDOM.render
OR if you use an ES6 class to define a component you can use extends React.Component{ render() { return someTag } }
What are props in React?
propertiesm they are objects
How do you pass props to a component?
as parameters
How do you write JavaScript expressions in JSX?
use curly braces
How do you create “class” component in React?
You use render()
How do you access props in a class component?
you need to specify “this”
What is the purpose of state in React?
to determine how a class should exist as
state is a data model over time