Course Content
React Mastery
React Mastery
1. Fundamentals of React and Component-Based UI
What Is React and Why Use It?Comparing SPAs and MPAs in Web DevelopmentHow React Works with the Virtual DOMIntroducing JSX for Writing HTML in JavaScriptBuilding Complex UI with JSX Rendering Elements in ReactChallenge: Render an Element in ReactUnderstanding React ComponentsPassing Data with Props in ReactChallenge: Create Functional ComponentsConditional Rendering in ReactChallenge: Implement Conditional Rendering – Chat NotificationChallenge: Implement Conditional Rendering – Bank AlertRendering Collections of Data in ReactChallenge: Display Data Collections in ReactReact Fundamentals Wrap-Up
2. Styling Techniques in React Applications
Introduction to Styling in ReactUsing Inline Styles in ReactApplying Inline Styles in PracticeChallenge: Use Inline Styles in a React ComponentStyling React Components with External CSSApplying External CSS in PracticeChallenge: Apply External CSS to a React AppUsing CSS Modules for Scoped Styling in React Organizing File and Folder Structures for StylesChallenge: Use CSS Modules in React Styling Techniques in React Wrap-Up
3. React Hooks and Context for State Management
Introduction to React Hooks and ContextManaging State with the useState HookChallenge: Toggle Visibility with useStateWorking with References Using the useRef HookChallenge: Build a Controlled Form ComponentHandling Side Effects with the useEffect HookChallenge: Fetch and Display Data with useEffectOptimizing Performance with the useMemo HookChallenge: Implement a Car List Filter with useMemoSharing State Across Components with ContextUsing Context in a Real-World ScenarioChallenge: Build a World of Astronomy App with ContextReact Hooks and Context Wrap-Up
Challenge: Build a Controlled Form Component
Task
In this challenge, you will create a Form
component with two input fields: email
and password
. The goal is to use the useRef
hook to reference the input elements and handle form submission logic.
Instructions
- Import the
useRef
hook from thereact
library. - Inside the
Form
component, declare twouseRef
variables:emailRef
andpasswordRef
, initialized withnull
. - Reset the input fields by setting their values to an empty string using the
useRef
variables.
- To import the necessary hook from the React library, include an
import
statement. - For this task, we will utilize the
useRef
hook to store data without affecting the markup. - To determine the appropriate variable name for the ref, choose a word that is associated with the ref and add "Ref" at the end.
- To initialize the ref with
null
, passnull
as the initial value in the brackets of theuseRef
hook (e.g.,useRef(null)
). - To reset the form input, use the appropriate ref variable and assign its
.current.value
to an empty string (""
).
Everything was clear?
Thanks for your feedback!
Section 3. Chapter 5