Get the most from each lesson’s live editor with a deliberate loop—the same habits that transfer to Vite, Create React App, or Next.js projects.
Recommended workflow
- Read the concept section before touching code.
- Click Run in browser to compile TSX and execute in the preview iframe.
- Use
printOutput(...)to inspect values in the terminal panel below the editor. - When a lesson shows UI, call
mountApp(<YourComponent />)— the preview renders inside#root. - Change one idea at a time (one prop, one state variable, one effect dependency).
- Read TypeScript errors in the terminal—they often point to wrong prop types before runtime.
- Reset the editor if you drift too far from the lesson goal.
What happens when you Run
- Your TSX is transpiled to JavaScript in the browser (same idea as
tsc+ JSX transform). - React 18 and ReactDOM load from CDN inside a sandboxed iframe.
ReactandReactDOMare available globals—destructure hooks:const { useState } = React;mountAppusescreateRootto render your element tree into the preview.
Review TypeScript intro if type errors block you—React components benefit heavily from typed props.
Self-check
- What is the difference between
printOutputandmountApp? - Why change one concept at a time while learning?
Challenge
First run
- Click Run in browser with the default code.
- Confirm
typeof Reactprintsobjectin the terminal. - Add a second
printOutputwith your name.
Done when: the terminal shows React types and your custom message.