“Cómo hacer reaccionar el botón de retroceso” Código de respuesta

Aplicar el botón de retroceso a un componente React

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

export const Item = () => {
    let history = useHistory();
    return (
        <>
          <button onClick={() => history.goBack()}>Back</button>
        </>
    );
};
Cruel Cassowary

Cómo hacer reaccionar el botón de retroceso

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);
Encouraging Earthworm

Respuestas similares a “Cómo hacer reaccionar el botón de retroceso”

Preguntas similares a “Cómo hacer reaccionar el botón de retroceso”

Más respuestas relacionadas con “Cómo hacer reaccionar el botón de retroceso” en JavaScript

Explore las respuestas de código populares por idioma

Explorar otros lenguajes de código