React is a JavaScript library for building UIs.
React is a JavaScript library used for building user interfaces using reusable components.
Virtual DOM is a lightweight copy of the real DOM. React compares Virtual DOM changes and updates only the required parts of the actual DOM.
Components are reusable pieces of UI. They can be Functional Components or Class Components.
JSX is JavaScript XML. It allows developers to write HTML-like syntax inside JavaScript.
Props are passed from parent to child and are read-only. State is managed inside the component and can be updated.
useState is a React Hook used to add state management in functional components.
useEffect is used to perform side effects such as API calls, subscriptions, and DOM updates.
React Router is a library used for navigation and routing in React applications.
Context API provides a way to share data globally without prop drilling.
Redux is a state management library used to manage application-wide state.
Lifecycle methods include Mounting, Updating, and Unmounting phases. Hooks such as useEffect are commonly used instead of lifecycle methods in functional components.
Lazy loading loads components only when needed, improving application performance.
const [count,setCount]=useState(0); <button onClick={()=>setCount(count+1)}>Increment</button>
useEffect(()=>{ fetch('/api/users').then(res=>res.json()).then(data=>setUsers(data)); },[]);
Use useState for search text and filter the array using filter() and includes().
Use useState to manage todos and implement Add, Delete, and Update functionality.
Maintain theme state using useState and conditionally apply CSS classes.
Use current page state and slice() method to display paginated data.
Create a reusable hook that manages loading, error, and data states.
Use React.memo, useMemo, useCallback, lazy loading, and code splitting.
MERN stands for MongoDB, Express.js, React.js, and Node.js. It is a full-stack JavaScript technology stack used to build web applications.
SQL databases use tables and rows, while MongoDB is a NoSQL database that stores data in JSON-like documents.
Mongoose is an ODM (Object Data Modeling) library for MongoDB and Node.js that provides schema-based data modeling.
Middleware functions execute during the request-response cycle and can modify request, response, or end the cycle.
JWT (JSON Web Token) is a secure way to authenticate users by generating a token after login and validating it on protected routes.
bcrypt is used to hash passwords before storing them in the database, improving security.
Authentication verifies who the user is, while authorization determines what the user is allowed to access.
Hooks allow functional components to use state and lifecycle features. Examples are useState, useEffect, useMemo, and useCallback.
useMemo memoizes computed values and prevents unnecessary recalculations during re-renders.
useCallback memoizes functions and prevents unnecessary recreation of functions on re-renders.
Context API allows data sharing across components without passing props manually through every level.
Using fetch() or axios inside useEffect or event handlers.
Cross-Origin Resource Sharing is a browser security feature that controls access between different origins.
REST API is an architectural style that uses HTTP methods such as GET, POST, PUT, and DELETE to manage resources.
The event loop allows Node.js to perform non-blocking I/O operations using asynchronous callbacks.
Validate user credentials, compare hashed password using bcrypt, generate JWT token, and return it.
Read token from headers, verify JWT, and allow access only for authenticated users.
Create, Read, Update, and Delete documents using Mongoose models.
Use useState, map(), and CRUD APIs to manage tasks.
Use filter() and state management to search data dynamically.
Use slice() and page state to display paginated data.
Configure multer middleware and store uploaded files on the server.
Store roles in JWT and check permissions using middleware.