react Flashcards
What is React?
A JavaScript library for building user interfaces
What is a React element?
objects you want to see on screen
How do you mount a React element to the DOM?
ReactDOM.render(whatYouWant, whereYouWantIt)
What is JSX?
a syntax extension that provides syntactic sugar to JavaScript
Why must the React object be imported when authoring JSX in a module?
JSX only works React
needs react obj
How can you make Webpack and Babel work together to convert JSX into valid JavaScript?
uses babel loader and updates JSX to valid JS
What is a React component?
a function that accepts properties as an argument and returns a React element
How do you define a function component in React?
function CapitalizedName (properties) { return Text Content
How do you mount a component to the DOM?
.render(ReactElem, domLocation)
What are props in React?
a special keyword in React used for passing data from one component to another
How do you pass props to a component?
Component Name attribute=’value’
How do you write JavaScript expressions in JSX?
with curly braces around it
How do you create “class” component in React?
class CapitalizedName extends React.Component { render() {return ReactElement} }
How do you access props in a class component?
this.props
What is the purpose of state in React?
keep track of a component’s dynamic data and determines the component’s behaviour