react-elements Flashcards
What is React?
a JS library for building user interfaces
What is a React element?
an object that describes an element (what gets returned from components)
How do you mount a React element to the DOM?
reactDOM.render()
What is JSX?
a syntax extension to JavaScript
Why must the React object be imported when authoring JSX in a module?
If you forget to import React, it will be undefined and the createElementcall will fail.
bc jsx isnt JS and need to be reconfigured
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
babel pugin transform react
What is a React component?
a javascript function, reusable
How do you define a function component in React?
function `ComponentName` { return
How do you mount a component to the DOM?
reactDOM.render
What are props in React?
arguments passed in react components, used to pass data from component to component
How do you pass props to a component?
props = ‘value’
How do you write JavaScript expressions in JSX?
{expression}
How do you create “class” component in React?
class `componentName` extends React.component { render ( ) { return {this.props.text} ; } }
How do you access props in a class component?
this.props.