Я создаю вкладку и добавляю маршрутизацию внутри первой вкладки. Но нужная страница не отображается после нажатия на ссылку. Хотя после обновления страницы соответствующая страница будет отображаться на экране. Кто-нибудь, пожалуйста, помогите мне решить эту проблему, где я делаю что-то не так, я использую UI материала для этого
function TabPanel(props) {
const { children, value, index, ...other } = props;
return (
<Typography
component="div"
role="tabpanel"
hidden={value !== index}
id={`simple-tabpanel-${index}`}
aria-labelledby={`simple-tab-${index}`}
{...other}
>
<Box p={3}>{children}</Box>
</Typography>
);
}
TabPanel.propTypes = {
children: PropTypes.node,
index: PropTypes.any.isRequired,
value: PropTypes.any.isRequired,
};
function a11yProps(index) {
return {
id: `simple-tab-${index}`,
'aria-controls': `simple-tabpanel-${index}`,
};
}
const useStyles = makeStyles(theme => ({
root: {
flexGrow: 1,
backgroundColor: theme.palette.background.paper,
},
}));
export default function SimpleTabs() {
const classes = useStyles();
const [value, setValue] = React.useState(0);
const handleChange = (event, newValue) => {
setValue(newValue);
};
return (
<div className={classes.root}>
<AppBar position="static">
<Tabs value={value} onChange={handleChange} aria-label="simple tabs example">
<Tab label="Item One" {...a11yProps(0)} />
<Tab label="Item Two" {...a11yProps(1)} />
<Tab label="Item Three" {...a11yProps(2)} />
</Tabs>
</AppBar>
<TabPanel value={value} index={0}>
<Router>
<ul className="navbar-nav mr-auto" >
<li><Link to={'/Text'} className="nav-link"><i class="fas fa-text-height"></i> Text </Link></li>
</ul>
<div>
</div>
</Router>
</TabPanel>
<TabPanel value={value} index={1}>
Item Two
</TabPanel>
<TabPanel value={value} index={2}>
Item Three
</TabPanel>
<Router>
<Switch>
<Route exact path='/Text' component={Text} />
</Switch>
</Router>
</div>
);
}
, поэтому, пожалуйста, скажите мне, где я должен измениться или что не так с кодом.