Skip to content

Instantly share code, notes, and snippets.

@numoonchld
Last active April 20, 2022 18:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numoonchld/fac8a3b9ce1c26dd4fa64aa974c86cee to your computer and use it in GitHub Desktop.
Save numoonchld/fac8a3b9ce1c26dd4fa64aa974c86cee to your computer and use it in GitHub Desktop.
React 18 - TS based index.js with Router
// h/t: https://github.com/facebook/create-react-app/issues/12219#issuecomment-1085567299
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
import { StrictMode } from 'react';
import App from './App';
import reportWebVitals from './reportWebVitals';
import './index.css';
const container = document.getElementById('root');
const root = createRoot(container as HTMLElement);
const app = (
<StrictMode>
<BrowserRouter>
<App />
</BrowserRouter>
</StrictMode>
);
root.render(app);
reportWebVitals();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment