Skip to content

Instantly share code, notes, and snippets.

@moshfiqrony
Created November 1, 2020 03:39
Show Gist options
  • Save moshfiqrony/7cedd6d3b1aed7904ab5286cee24ba4e to your computer and use it in GitHub Desktop.
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
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