[ad_1]
I want to use React.lazy Import and useState so I can firstly receive server informations and then updating informations on that module, can someone help?
// State
let [GameComponent, setGameComponent] = useState(React.lazy(() => import('./game_screens/default.js')))
// Thing below is inside useEffect()
server.on('check start', args =>{
if (args['exists']){
setGameComponent(React.lazy(() => import(gameTypes[args['game']]['mode'])));
}
})
// And then the component is like that on the .js
<GameComponent/>
[ad_2]