简体   繁体   中英

Frontend integration on React 18.1.0

I'm not able to write the code inside the index.js file. I wrote the code as per the code sandbox section of cube docs. It sends a console warning that my app may work as React 17. When I followed 18.1.0 conventions the page was shown loading and never stopped. Any solution to this? It's written like this currently and I've added CubeProvider to access cubejsapi at app.js file while setting up routes, which is working fine.

 import React from 'react'; import ReactDOM from 'react-dom'; import App from './App'; import { AuthProvider } from './context/AuthProvider'; import reportWebVitals from './reportWebVitals'; import 'bootstrap/dist/css/bootstrap.min.css'; ReactDOM.render( <React.StrictMode> <AuthProvider> <App /> </AuthProvider> </React.StrictMode>, document.getElementById('root') );

Does AuthProvider a default export or named export?

For good practice, move the AuthProvider to the app component .

Index.js need to be codeless as you can.

More of context here : https://reactjs.org/docs/context.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM