With react 17 via lazy loading, i was dynamically loading one of three components according to the selected language (state variable from zustand store). The import depends on that variable:
const MyComponent = lazy(() => import(`component-${language}.jsx`))
After migrating to react 18, the component is in infinite rendering.
I imagine it's related to the new automatic batching feature.
Somebody can help ? Best Regards
create a function outside the component to receive the variable as prop from the component or as direct import from the store but the error persists.
instead of the state variable i tried a getter from the store but with no success.
tried to use useState and useEffect replacing the state variable on the import but also with no success.