fullstack Flashcards
What is a React component?
a JavaScript class or function that optionally accepts inputs i.e. properties(props) and returns a React element that describes how a section of the UI (User Interface) should appear
How do you define a function component in React?
write it as a function or us an ES6 class
How do you mount a component to the DOM?
By using ReactDOM.render()
What are props in React?
props are inputs that can taken as arguments for components
Object
How do you pass props to a component?
How do you write JavaScript expressions in JSX?
by using curly braces
What Array method is commonly used to create a list of React elements?
Array.Prototype.map()
What is the best value to use as a “key” prop when rendering lists?
a string that uniquely identifies a list item among its siblings
How do you create “class” component in React?
Create an ES6 class that extends React.Component.
Add a single empty method to it called render().
this.props in the render() body.
How do you access props in a class component?
this.props
What is the purpose of state in React?
It represents the parts of the app that can change
How to you pass an event handler to a React element?
render(){
}
what is super
super is the constructor of the class you are extending