![]() There must be something wrong with the way I'm rendering the main routes component in the app component but I'm stumped, can anyone shed some light? Also note this has nothing to do with react-router's switch.ĮDIT: I've modified one of my old test project to demonstrate this bug, you can clone the repo from - once the repo's cloned just run an npm install in root dir and npm start. Loader: () => import('./systemAdminRoutes/SystemAdminRoutes'),Īnd then the routes component const SystemAdminRoutes = () => and getting props via redux Import * as Loadable from 'react-loadable' Import LoadingPage from '././components/sharedPages/loadingPage/LoadingPage' The route rendering Routes renders a component that switches on the user role and lazy loads the correct routes component based on that role, that routes component renders a switch for the main pages. I found an article on how to test the router using Jest and Enzyme that uses the mount function from Enzyme. However, shallow doesn’t work for React Router deep render is necessary to test this. I have a route within my app rendered as below Most of them suggested using Enzyme’s shallow function for rendering the parent component (in this case App). ![]() import as React from react import LoadingPage from. Please read this properly before marking as duplicate, I assure you I've read and tried everything everyone suggests about this issue on stackoverflow and github. The route rendering Routes renders a component that switches on the user role and lazy loads the correct routes component based on that role, that routes component renders a switch for the main pages.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |