What is tree shaking?
Simple meaning
Bundlers drop unused ES module exports when they can prove they are unused.
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.
Bundlers drop unused ES module exports when they can prove they are unused.
Open the full page for Why, Steps, Example and Key takeaway.
I render the form, find fields by label text, type with userEvent, and click the submit button by role.
Open the full page for Why, Steps, Example and Key takeaway.
Classes change during restyles even when the user experience did not.
Open the full page for Why, Steps, Example and Key takeaway.
Aria-label is a string on the element itself.
Open the full page for Why, Steps, Example and Key takeaway.
Native input type checkbox is best.
Open the full page for Why, Steps, Example and Key takeaway.
If you assign a string that contains a script or an onerror handler from the user, the browser will execute it.
Open the full page for Why, Steps, Example and Key takeaway.
HttpOnly stops document.cookie from reading the session, which reduces XSS token theft.
Open the full page for Why, Steps, Example and Key takeaway.
GetStaticProps builds HTML at build time, great for marketing pages.
Open the full page for Why, Steps, Example and Key takeaway.
The HTML from the server does not equal what React renders on the client for the first pass.
Open the full page for Why, Steps, Example and Key takeaway.
They catch errors during render, lifecycle, and constructors of children via componentDidCatch.
Open the full page for Why, Steps, Example and Key takeaway.
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.