React Version — React Technical Interview Questions & Answers
React Version
React Version
- React versions matter because APIs changed. Class components were the default for years. Hooks arrived in 16.8. React 18 added createRoot and concurrent rendering. In a viva, say the era you write: function components + hooks, React 18+ createRoot — not ReactDOM.render.
- Don’t mug a patch like 18.2.0 as if it were history. Check package.json on a real project. react and react-dom should share the same major. Mixing 17 and 18 is a support headache.
- React Version — output: three era lines. Interview wants 18+ createRoot, not a random patch.
Technical Interview Tip: Hooks era + createRoot. Check package.json.
Code Examples for React Version
Example
// Versions
console.log("React 16: class + early hooks");
console.log("React 18: concurrent + createRoot");
console.log("Check package.json → react version");
React Version — output: three era lines. Interview wants 18+ createRoot, not a random patch.
How to Explain React Version to an Interviewer
When did hooks arrive?
16.8
What replaced ReactDOM.render?
createRoot