Example #7Source File: FlatRoutes.tsx From backstage with Apache License 2.0 5 votes FlatRoutes = (props: FlatRoutesProps): JSX.Element | null => { const app = useApp(); const { NotFoundErrorPage } = app.getComponents(); const routes = useElementFilter(props.children, elements => ...
const root= ReactDOM.createRoot(document.getElementById('root')); root.render(<Router />);//If you want to start measuring performance in your app, pass a function//to log results (for example: reportWebVitals(console.log))//or send to an analytics endpoint. Learn more: https://bit....
The error "useRoutes() may be used only in the context of a Router component" occurs when we try to use the useRoutes hook outside of the Router context.
(<React.StrictMode><Router><App/></Router></React.StrictMode>,document.getElementById("root"));// If you want to start measuring performance in your app, pass a function// to log results (for example: reportWebVitals(console.log))// or send to an analytics endpoint. Learn more: https...
As shown in the example it's certainly possible to use these utility functions to get server side rendering working. It's just my opinion that having some bits of the public API accept the jsx type and some not violates least surprise. the classes get populated client side, but not server...