Global outlined override

Offhand, I’m not certain how many different components have an “outlined” variant. You won’t be able to address all of them in a single CSS rule, but they can each be dealt with separately in your theme. In this answer I will just address OutlinedInput and outlined Button. If you have questions about overriding styles … Read more

Using async/await inside a React functional component

You will have to make sure two things useEffect is similar to componentDidMount and componentDidUpdate, so if you use setState here then you need to restrict the code execution at some point when used as componentDidUpdate as shown below: function Dashboard() { const [token, setToken] = useState(”); useEffect(() => { // You need to restrict … Read more

Intercept/handle browser’s back button in React-router?

This is a bit old question and you’ve probably already got your answer, but for people like me who needed this, I’m leaving this answer. Using react-router made the job simple as such: import { browserHistory } from ‘react-router’; componentDidMount() { super.componentDidMount(); this.onScrollNearBottom(this.scrollToLoad); this.backListener = browserHistory.listen(location => { if (location.action === “POP”) { // Do … Read more