“ubah rute pada tombol klik bereaksi” Kode Jawaban

Menavigasi secara program bereaksi

import { Route } from 'react-router-dom'

const Button = () => (
  <Route render={({ history}) => (
    <button
      type='button'
      onClick={() => { history.push('/new-location') }}
    >
      Click Me!
    </button>
  )} />
)
Clean Chamois

ubah rute pada tombol klik bereaksi

class Login extends Component {
    nextPath(path) {
    this.props.history.push(path);
  }
    render() {
        return (
        <div>
        <button type='button' onClick={() => this.nextPath('/yourpath') } >Button</button>
        </div>
        );
}
        
Plain Pintail

Jawaban yang mirip dengan “ubah rute pada tombol klik bereaksi”

Pertanyaan yang mirip dengan “ubah rute pada tombol klik bereaksi”

Lebih banyak jawaban terkait untuk “ubah rute pada tombol klik bereaksi” di JavaScript

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya