2
2
* Main App component
3
3
*/
4
4
import React , { useLayoutEffect , useEffect , useRef } from "react" ;
5
- import { Router , useLocation , Redirect } from "@reach/router" ;
5
+ import { Router , useLocation } from "@reach/router" ;
6
6
import { disableSidebarForRoute } from "@topcoder/micro-frontends-navbar-app" ;
7
7
import _ from "lodash" ;
8
8
import { usePreviousLocation } from "./utils/hooks" ;
9
- import Parcel from ' single-spa-react/parcel'
10
- import { useSelector } from ' react-redux'
11
- import ReactDOM from ' react-dom'
9
+ import Parcel from " single-spa-react/parcel" ;
10
+ import { useSelector } from " react-redux" ;
11
+ import ReactDOM from " react-dom" ;
12
12
13
13
import "./styles/main.scss" ;
14
14
15
- import Menu from ' ./containers/Menu'
15
+ import Menu from " ./containers/Menu" ;
16
16
17
17
const App = ( ) => {
18
- const menuVisible = useSelector ( state => state . menu . show )
18
+ const menuVisible = useSelector ( ( state ) => state . menu . show ) ;
19
19
20
20
useLayoutEffect ( ( ) => {
21
21
disableSidebarForRoute ( "/earn/*" ) ;
@@ -36,11 +36,19 @@ const App = () => {
36
36
37
37
return (
38
38
< >
39
- { menuVisible && ReactDOM . createPortal ( < Menu /> , document . querySelector ( '#menu-id' ) ) }
39
+ { menuVisible &&
40
+ ReactDOM . createPortal ( < Menu /> , document . querySelector ( "#menu-id" ) ) }
40
41
< Router >
41
- < Parcel path = "/earn/find/challenges" config = { ( ) => System . import ( '@topcoder/micro-frontends-challenges-app' ) } />
42
- < Parcel path = "/earn/my-gigs" config = { ( ) => System . import ( '@topcoder/micro-frontends-gigs-app' ) } />
43
- < Redirect from = "/earn/*" to = "/earn/find/challenges" noThrow />
42
+ < Parcel
43
+ path = "/earn/find/challenges/*"
44
+ config = { ( ) =>
45
+ System . import ( "@topcoder/micro-frontends-challenges-app" )
46
+ }
47
+ />
48
+ < Parcel
49
+ path = "/earn/my-gigs"
50
+ config = { ( ) => System . import ( "@topcoder/micro-frontends-gigs-app" ) }
51
+ />
44
52
</ Router >
45
53
</ >
46
54
) ;
0 commit comments