What is react?
- React is a JavaScript library used for building user interfaces UIs.
- Created by Facebook (Meta)
- It helps developers build single-page applications (SPAs) where the page updates dynamically without refreshing
When react use?
- Dynamic web apps like dashboards, social media, e-commerce.
- Single Page Applications (SPAs) where only parts of the page update.
- Reusable UI components like buttons, forms, cards that can be used again.
Why use React?
- Fast Uses Virtual DOM for quick updates.
- Reusable Build components once, reuse everywhere.
- Popular & Supported Huge community, lots of libraries.
- Easy to scale Good for small projects and big apps.
- Cross-platform React for web, React Native for mobile apps.
How is React used?
Steps to use React in a project:
- Install Node.js → needed for React.
- Create a React app (using Vite or Create React App).
npm create vite@latest my-app
cd my-app
npm install
npm run dev
How to write components using JSX.
function App() {
return <h1>Hello React!</h1>;
}
export default App;
- Run the app in the browser and React renders components dynamically
Top comments (0)