Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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>
        </>
    );
};
Comment

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);
Comment

PREVIOUS NEXT
Code Example
Javascript :: font awesome cdn svg with js 
Javascript :: expose deployment nodeport command 
Javascript :: javaScript setSeconds() Method 
Javascript :: javascript is array empty 
Javascript :: toarray javascript 
Javascript :: regex expression to match domain name 
Javascript :: define an unsigned int js 
Javascript :: array js fill 
Javascript :: make multiple array in one array 
Javascript :: js check if array of dictionaries contain 
Javascript :: iterate array in javascrpt 
Javascript :: create csv file nodejs 
Javascript :: npm install nodemon 
Javascript :: js if dark mode 
Javascript :: Passing components as children in react 
Javascript :: install vue by CDN 
Javascript :: javascript two decimal places after division 
Javascript :: Pass object to query on Router.push NextJs 
Javascript :: js get file location 
Javascript :: javascript auto scroll a page to top 
Javascript :: npm got 
Javascript :: uppercase in javascript 
Javascript :: focus element javascript 
Javascript :: install stripe to react/nodejs - typescript 
Javascript :: js char array to string 
Javascript :: jquery get 2 hours frmo now 
Javascript :: jquery option not disabled 
Javascript :: jquery has parent with class 
Javascript :: repeat an array multiple times in js 
Javascript :: axios patch 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =