React 18: Concurrent Features and the New Root API

React 18 introduced concurrent rendering, automatic batching, and a new root API. These changes improve perceived performance without rewriting your entire app.

createRoot

import { createRoot } from 'react-dom/client';
import App from './App';

const root = createRoot(document.getElementById('root'));
root.render(<App />);

The legacy ReactDOM.render is deprecated. createRoot enables concurrent features.

Suspense and Transitions

useTransition marks updates as non-urgent-keeping the UI responsive during heavy re-renders:

const [isPending, startTransition] = useTransition();

function handleTab(tab) {
  startTransition(() => setActiveTab(tab));
}

Strict Mode Changes

Strict Mode double-invokes effects in development to surface side-effect bugs. Audit useEffect cleanup functions before upgrading.

Conclusion

Upgrade to React 18 incrementally. Most apps benefit from automatic batching and the new root API with minimal code changes.