import React from 'react'
import { withRouter } from 'react-router'

const Hello = (props) => {
  return (
    <div><button onClick={ () => props.history.push('/about') }>Hello</button></div>
  )
}

const WithRouterHello = withRouter(Hello);//也可以用es6的语法@

const Home = (props) => {
  return (
    <div>
      <button onClick={ () => props.history.push('/about') }>click me</button>
      <p>Welcome Home</p>
      <WithRouterHello />
    </div>
  )
}

export default Home

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-09
  • 2021-07-16
  • 2021-09-02
  • 2021-06-20
猜你喜欢
  • 2021-07-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-30
  • 2022-12-23
相关资源
相似解决方案