Default parameters replace defaultProps on function components
defaultProps was ignored, so name is undefined, and the broken propTypes validator never ran: no warning at all. Classes still support static defaultProps.
React 19 (December 2024) added Actions and the form hooks, use, document metadata, resource loading, ref as a prop and <Context> as a provider, and removed long-deprecated APIs such as ReactDOM.render, string refs, legacy context, propTypes checks and defaultProps on function components; 19.1 and 19.2 added Owner Stacks, <Activity>, useEffectEvent and more.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Rewrite this mount code for React 19: ReactDOM.render(<App />, document.getElementById("root")); and later ReactDOM.unmountComponentAtNode(document.getElementById("root"));.
Rewrite function Badge({ color, label }) { … } with Badge.defaultProps = { color: "gray", label: "New" } for React 19.
Explain it without notes
What are the headline features of React 19?
Which APIs were removed in React 19, and what replaces each?
How would you upgrade a large React 18 app to React 19 safely?
Why can removing defaultProps support cause bugs that tests miss?
Preview
Console
Nothing logged yet.Expected console output
Old: Hello, undefined
New: Hello, friend