Answers for "apply back button to a react component"

0

apply back button to a react component

import { useHistory } from "react-router-dom";

export const Item = () => {
    let history = useHistory();
    return (
        <>
          <button onClick={() => history.goBack()}>Back</button>
        </>
    );
};
Posted by: Guest on March-08-2021
0

how to make back button react

const BrowserHistory = require('react-router/lib/BrowserHistory').default;

const App = React.createClass({
    render: () => {
        return (
            <div><button onClick={BrowserHistory.goBack}>Go Back</button></div>
        );
    }
});

React.render((
    <Router history={BrowserHistory}>
        <Route path="/" component={App} />
    </Router>
), document.body);
Posted by: Guest on October-22-2020

Code answers related to "apply back button to a react component"

Code answers related to "Javascript"

Browse Popular Code Answers by Language