I am wondering how to use React Router when the Navbar is a separate component.
index.js
import React from 'react'
import ReactDOM from 'react-dom'
// Styles
import CssBaseline from '@material-ui/core/CssBaseline'
import { ThemeProvider } from '@material-ui/styles'
import theme from './theme'
// Components
import App from './App'
ReactDOM.render(
<ThemeProvider theme={theme}>
<CssBaseline />
<App />
</ThemeProvider>,
document.getElementById('root')
)
App.js
import React from 'react'
// Styling
import Container from '@material-ui/core/Container'
import Button from '@material-ui/core/Button'
//Components
import Hero from './components/Hero'
import Menubar from './components/Menubar'
function App() {
return (
<React.Fragment>
<Container maxWidth='lg'>
<Menubar />
</Container>
<Hero />
<Container maxWidth='lg'>
<h1>My new web site using Material UI</h1>
<Button variant='contained' color='primary'>
Hello
</Button>
</Container>
</React.Fragment>
)
}
export default App
I am relatively new to React and I cannot seem to figure this part out. The tutorials I have found are not very helpful.