An easy-to-use platform for EEG experimentation in the classroom
1import * as React from 'react';
2import { useEffect } from 'react';
3import { useLocation } from 'react-router-dom';
4import { useDispatch } from 'react-redux';
5import { ToastContainer } from 'react-toastify';
6import TopNav from './TopNavBarContainer';
7import { RouterActions } from '../actions/routerActions';
8
9function NavigationTracker() {
10 const location = useLocation();
11 const dispatch = useDispatch();
12 useEffect(() => {
13 dispatch(RouterActions.RouteChanged(location.pathname));
14 }, [location.pathname, dispatch]);
15 return null;
16}
17
18type Props = {
19 children: React.ReactNode;
20};
21
22export function App(props: Props) {
23 return (
24 <div>
25 <NavigationTracker />
26 <TopNav />
27 {props.children}
28 <ToastContainer />
29 </div>
30 );
31}