This repository is part of my journey to learn React through the FrontendMaster React Intro course. It contains the demo projects and exercises I've built while following the course.
- React application -
This project showcases the fundamentals of React, a popular JavaScript library for building user interfaces. It includes key concepts like:
- Components
- Props and State
- Event handling
- React hooks (useState, useEffect, etc.)
- Building modular and interactive UIs
This is a hands-on demo repository where I:
- Practice React concepts taught in the course.
- Build interactive features step-by-step.
- Deepen my understanding of React and frontend development.
To run the project, ensure the following are installed:
- Node.js (LTS version recommended)
- npm (comes with Node.js) or yarn
-
Clone this repository:
git clone https://github.com<your-username>/frontendmaster-react-intro-tutorial.git cd frontendmaster-react-intro-tutorial
-
Install project dependencies:
npm install
-
Clone the repo from bholt to run the backend api (
/api
directory) needed for the frontend -
Start the development server:
npm run dev
-
Open your browser and navigate to http://localhost:3000 to view the demo app.
- Basic React Components: Reusable components to build a modular UI.
- Interactive State Management: Handling dynamic behavior with React useState.
- Vite Setup: Leveraging a fast development server and build tool.
Here are some useful commands:
npm run dev
: Starts the local development server.npm run build
: Bundles the app for production.npm run lint
: Checks for code style and errors using ESLint.
This project is powered by:
- React: For building interactive UIs.
- JavaScript (ES6+): Writing modern and clean JavaScript.
- Vite: A fast and efficient development/build tool.
- Follow along with the FrontendMaster React course to complete all demos.
- Learn how to structure a React project for scalability.
- Gain confidence in using React features like hooks, state, and props.
- Special thanks to FrontendMaster for the amazing course and tutorials.
- Inspiration for this project comes from my goal to improve my frontend skills and build robust web applications.
- Using context and state; use context when you have a state that it used in multiple points of your application like user profile, shopping cart, theme. You can use usestate when you have a state that needs to be managed when the view is active, like filling a form and you need to pass the data forward to another component
- When we use context we want to provide app level state
- We can use it like the useState only that it's managed somewhere else in our application and other components can also use the same data or information
- Setup
- Choose where to use it and where it's needed to be read
- Create the context
- Render the context at the right component level
- Set up the hook for the context provider
- Import useContext and your custom context
- Use useContext(your-custom-context) with state values [cart, setCart]