๐ง 191. What is a Progressive Web App (PWA)?
A Progressive Web App (PWA) is a web application that provides an app-like experience in a browser.
Features:
โ Works offline
โ Fast loading
โ Installable on devices
โ Push notifications
โ Responsive design
Examples: Twitter Lite, Pinterest, Starbucks PWA
Benefits:
No app store required
Better performance
Improved user engagement
๐ง 192. What is a Service Worker?
A Service Worker is a JavaScript file that runs in the background independently of a webpage.
Responsibilities:
Caching resources
Offline support
Push notifications
Background sync
Example:
navigator.serviceWorker.register("/service-worker.js")Benefits:
โ Offline access
โ Faster page loading
โ Better user experience
๐ง 193. What is Lazy Loading?
Lazy loading means loading resources only when they are needed.
Examples: Images, Components, Videos
React Example:
const Home = React.lazy(() => import("./Home"))Benefits:
โ Faster initial page load
โ Better performance
โ Reduced bandwidth usage
๐ง 194. What is Code Splitting?
Code splitting divides a large JavaScript bundle into smaller chunks.
Example:
Instead of loading:
app.js = 5 MBLoad:
home.js, profile.js, dashboard.jsBenefits:
โ Faster loading
โ Better performance
โ Smaller bundles
๐ง 195. What is Tree Shaking?
Tree shaking removes unused code from final production bundles.
Example:
import { add } from "./math"Unused functions are removed during build.
Benefits:
โ Smaller bundle size
โ Faster application
๐ง 196. What is SSR in Next.js?
SSR stands for: Server-Side Rendering
In SSR, HTML is generated on the server before being sent to the browser.
Benefits:
โ Better SEO
โ Faster initial page load
โ Improved performance
Flow: Browser โ Server โ Rendered HTML โ Browser
๐ง 197. What is Hydration in React?
Hydration is the process where React attaches event handlers to server-rendered HTML.
Flow: Server Render HTML โ Browser Loads HTML โ React Adds Interactivity
Benefits: โ Interactive pages, โ Better user experience
๐ง 198. What is Webpack?
Webpack is a module bundler that combines project files into optimized bundles.
Responsibilities:
Bundling files
Minification
Code splitting
Asset optimization
Example:
module.exports = {
entry: "./src/index.js"
}