Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import { hydrateRoot, createRoot } from 'react-dom/client' import App from './App' /** * When `#redwood-app` isn't empty then it's very likely that you're using * prerendering. So React attaches event listeners to the existing markup * rather than replacing it. * https://reactjs.org/docs/react-dom-client.html#hydrateroot */ const redwoodAppElement = document.getElementById('redwood-app') if (!redwoodAppElement) { throw new Error( "Could not find an element with ID 'redwood-app'. Please ensure it exists in your 'web/src/index.html' file." ) } if (redwoodAppElement.children?.length > 0) { hydrateRoot(redwoodAppElement, <App />) } else { const root = createRoot(redwoodAppElement) root.render(<App />) } |