Created
November 1, 2020 03:39
-
-
Save moshfiqrony/7cedd6d3b1aed7904ab5286cee24ba4e to your computer and use it in GitHub Desktop.
It demo the process how slack uses url to open hide their sidebar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { Route, Switch } from 'react-router'; | |
import Dialog from '@material-ui/core/Dialog' | |
const ABC = ({ match, history, ...rest }) => { | |
return ( | |
<div> | |
<h1 | |
onClick={() => history.push(`${match.url}/2`)} | |
> | |
Click me | |
</h1> | |
<Switch> | |
<Route | |
path={`${match.url}/2`} | |
component={ | |
() => <Dialog onClick={() => history.push(`${match.url}`)} open={true}/> | |
} | |
/> | |
</Switch> | |
</div> | |
) | |
} | |
export default ABC; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment