← React Beginner Questions - Set 1 Q1
What is React?
React Beginner Questions - Set 1
The smallest complete React app: one component, mounted into a DOM node. Everything else in React is a variation on this.
Example
1
2
3
4
5
6
7
8
import { createRoot } from 'react-dom/client';
function App() {
return <h1>Hello from React</h1>;
}
const root = createRoot(document.getElementById('root'));
root.render(<App />);
What to notice
- React is a library, not a framework: it renders UI and leaves routing, data fetching and state management to other packages.
- The return value of a component is a description of the UI, not DOM nodes. React turns it into DOM for you.
- No jQuery-style DOM updates anywhere — the only imperative call is the one that mounts the app.
← Back to the question list