What is Intersection Observer used for?
Simple meaning
It tells you when an element enters the viewport without scroll listeners.
Open the full page for Why, Steps, Example and Key takeaway.
Panel-ready Frontend Master questions for freshers and experienced developers. Practice at Coding Cadre in Faridabad, or Online from Delhi NCR.
It tells you when an element enters the viewport without scroll listeners.
Open the full page for Why, Steps, Example and Key takeaway.
PushState and replaceState change the URL without a full reload, which SPAs use for routing.
Open the full page for Why, Steps, Example and Key takeaway.
Inline styles beat classes and ids unless a rule uses important.
Open the full page for Why, Steps, Example and Key takeaway.
All fails fast if any promise rejects, which is good when every request is required.
Open the full page for Why, Steps, Example and Key takeaway.
The question mark dot stops the lookup and returns undefined if the left side is null or undefined.
Open the full page for Why, Steps, Example and Key takeaway.
A custom hook is a function starting with use that calls other hooks, so I can reuse stateful logic.
Open the full page for Why, Steps, Example and Key takeaway.
Document.cookie can set cookies the page can also read, so XSS can steal them.
Open the full page for Why, Steps, Example and Key takeaway.
They are variables defined with a double-dash name, often on :root, and read with var.
Open the full page for Why, Steps, Example and Key takeaway.
React 18 batches setState in timeouts, promises, and native events so one event loop turn can become one render.
Open the full page for Why, Steps, Example and Key takeaway.
If I add a window resize listener in useEffect and forget the cleanup, the handler keeps the component closure alive after unmount.
Open the full page for Why, Steps, Example and Key takeaway.
Required, type email, minlength, and pattern give native validation even if JS fails.
Open the full page for Why, Steps, Example and Key takeaway.
Lazy loading waits until the image is near the viewport, saving bandwidth.
Open the full page for Why, Steps, Example and Key takeaway.
A generic is a type parameter so a function or component works with many shapes while keeping the relationship.
Open the full page for Why, Steps, Example and Key takeaway.
Middleware wraps dispatch so I can log, crash-report, or run async.
Open the full page for Why, Steps, Example and Key takeaway.
A layout wraps child routes and does not remount on navigation inside that segment, so shared chrome stays mounted.
Open the full page for Why, Steps, Example and Key takeaway.
Unit tests cover a pure function or a small component with mocked children.
Open the full page for Why, Steps, Example and Key takeaway.
It is the first focusable link that jumps to main content so keyboard users skip the nav.
Open the full page for Why, Steps, Example and Key takeaway.
Any XSS on the origin can read localStorage and send the token to an attacker.
Open the full page for Why, Steps, Example and Key takeaway.
I name cells and draw the layout as ASCII in CSS, which is easier to review than long line and column numbers.
Open the full page for Why, Steps, Example and Key takeaway.
Slice returns a shallow copy of a portion and does not change the original, which is what I want in React.
Open the full page for Why, Steps, Example and Key takeaway.