Navigate inside of my-react-app
by using the change directory command:
cd my-react-app
Then, you can start the Vite development server by running:
npm run dev
This will start the Vite development server.
You can view this solutions app at http://localhost:3501.
NOTICE THAT FOR THIS SOLUTION REPO, IT WILL RUN ON PORT 3501, NOT PORT 5501.
The project structure should look like this:
my-react-app/ ├── index.html ├── package.json ├── src/ │ ├── App.jsx │ ├── main.jsx │ └── index.css ├── vite.config.js └── node_modules/
Exercise instructions are in the file named EXERCISE-INSTRUCTIONS.txt
inside
of the my-react-app
directory.
Individual exercise solution files are in the folder exerciseSolutions
inside
of the my-react-app
directory.
-
React Components:
- Building functional components.
- Using JSX to describe the UI structure.
-
React State Management:
- Managing state with
useState
. - Handling derived state.
- Using
useEffect
for side effects, such as fetching data. - Custom hooks to streamline code.
- Error boundaries for catching and displaying errors gracefully.
- Managing state with
-
Routing with React Router:
- Setting up routing using
react-router-dom
. - Declaring routes with
Route
and usingLink
for navigation. - Using URL parameters with
useParams
. - Handling 404 pages with custom components.
- Using
useNavigate
for programmatic navigation.
- Setting up routing using
-
Event Handling:
- Handling events such as form submissions and button clicks.
- Using React's synthetic event system for consistent event handling.
-
Fetching Data and Error Handling:
- Fetching data using async/await and promises.
- Handling loading states and errors effectively.
- Using a mock API to simulate real-world data fetching.
-
Performance Optimization:
- Using hooks like
useCallback
anduseMemo
for optimization. - Techniques to avoid unnecessary re-renders.
- Using hooks like
-
Custom Hooks:
- Creating and using custom hooks to simplify repetitive logic.
- Centralizing data-fetching logic.