fairly new to the coding space. I have tried looking everywhere for the answer to this question, and while I've found many answers, none of them work for me.
My problem is that I would like to use @Material-UI tab components as a NavBar, and I can only seem to either 1. turn the tabs into static links that work but have no animation or indicator, or 2. keep the animations but have no functionality as far as changing the page goes.
I have tried this, this, this, and more, and many of the answers found within each of those.
Edit: Here is a Git Repo.
Here is my NavBar component, currently on status #2 where it has animations but not functionality:
import React from 'react';
import { Paper, Tabs, Tab } from '@material-ui/core';
const navStyle= {
backgroundColor: '#220000',
color: '#fff',
}
export class NavBar extends React.Component {
state = {
value: 0,
};
handleChange = (event, value) => {
event.preventDefault();
this.setState({ value });
console.log(value)
};
render() {
return (
<div>
<Paper>
<Tabs
value={this.state.value}
onChange={this.handleChange}
indicatorColor={"secondary"}
// textColor="secondary"
centered
style={navStyle}
>
<Tab label="Home" href='/' />
<Tab label="About" href='/about' />
</Tabs>
</Paper>
</div>
)}
}
dependencies:
"@material-ui/core": "^1.3.1",
"history": "^4.7.2",
"prop-types": "^15.6.2",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router-dom": "^4.3.1",
"react-scripts": "1.1.4"