React Class Components Learning Objectives
As you’ve learned the fundamentals of React, you’ve seen how to use functions to create components. You can also create components using ES2015 classes. After reading and practicing, you should be able to:
- Create a simple React application by removing items and content from a project generated by the Create React App default template
- Create a simple React application using a custom Create React App template
- Create a React component using ES2015 class syntax
- Describe when it’s appropriate to use a class component
- Initialize and update state within a class component
- Provide default values for a class component’s props
- Add event listeners to elements
- Prevent event default behavior
- Safely use the
this
keyword within event handlers
- Describe what the React
SyntheticEvent
object is and the role it plays in handling events
- Create a React class component containing a simple form
- Define a single event handler method to handle
onChange
events for multiple <input>
elements
- Add a
<textarea>
element to a form
- Add a
<select>
element to a form
- Implement form validations
- Describe the lifecycle of a React component
- Recall that the commonly used component lifecycle methods include
componentDidMount
, componentDidUpdate
, and componentWillUnmount
- Use the
componentDidMount
component lifecycle method to fetch data from an API
- Utilize official documentation to gain an understanding of how new technology works