I am practicing typescript. I have error "Type 'void' is not assignable to type 'boolean'" for setAuthenticated(valueFromChild) line and "...is not assignable to type 'IntrinsicAttributes & { children?: ReactNode; }'." for all places(,) where I pass props into child components here. How do I fix the errors?
import { FunctionComponent, useState } from 'react';
import { BrowserRouter, Switch, Route } from 'react-router-dom';
import Navbar from './Components/navbar.component';
import './App.css';
import { ThemeProvider } from '@material-ui/core/styles';
import theme from './Theme/theme';
import Login from './Components/login.component';
import Register from './Components/register.component';
const App: FunctionComponent = () => {
const [isAuthenticated, setIsAuthenticated] = useState<boolean>(false);
const handleAuth = (valueFromChild: boolean): boolean =>
setIsAuthenticated(valueFromChild);
return (
<ThemeProvider theme={theme}>
<BrowserRouter>
<Navbar isAuthenticated={isAuthenticated} />
<Switch>
<Route
exact
path="/login"
render={(props) => <Login {...props} handleAuth={handleAuth} />}
/>
<Route
exact
path="/register"
render={(props) => <Register {...props} handleAuth={handleAuth} />}
/>
</Switch>
</BrowserRouter>
</ThemeProvider>
);
};
export default App;