Reactjs ReactRouter工作不正确,仅更改url而不查看

Reactjs ReactRouter工作不正确,仅更改url而不查看,reactjs,react-router,Reactjs,React Router,我不明白为什么不去页面,只是简单地更改URL import React, { Component } from 'react' import PropTypes from 'prop-types' import { Link, withRouter } from 'react-router-dom' import classify from 'src/classify' import defaultClasses from './logo.scss' import logo from './lo

我不明白为什么不去页面,只是简单地更改URL

import React, { Component } from 'react'
import PropTypes from 'prop-types'
import { Link, withRouter } from 'react-router-dom'
import classify from 'src/classify'
import defaultClasses from './logo.scss'
import logo from './logo.svg'
class Logo extends Component {
  static propTypes = {
    classes: PropTypes.shape({
      wrapper: PropTypes.string,
      logo: PropTypes.string
    })
  }

  render() {
    const { classes, history } = this.props

    return (
      <Link to="/" className={classes.wrapper}>
        <img className={classes.logo} src={logo} height="70"  alt="" title="" />
      </Link>
    )
  }
}

export default classify(defaultClasses)(Logo)
使用上下文

   this.props.pushContext({
      nav: <Logo />,
      background: 'white'
    })
this.props.pushContext({
导航:,
背景:“白色”
})

您忘记关闭
渲染视图中的
开关
组件

const renderRoutes = () => (
  <Switch>
    <Route exact path="/" component={Page} />
    <Route exact path="/journey/" component={Journey} />
  </Switch> <-- You forgot to close your Switch here.
)
const renderRoutes=()=>(

您忘记关闭
渲染器中的
开关
组件

const renderRoutes = () => (
  <Switch>
    <Route exact path="/" component={Page} />
    <Route exact path="/journey/" component={Journey} />
  </Switch> <-- You forgot to close your Switch here.
)
const renderRoutes=()=>(

你能提供
renderRoutes()
的代码和你调用它的地方吗?你在任何地方创建了实际的React路由器吗?如果没有相应的@Luze添加的代码,A将无法工作。你应该先声明路由。然后是路由。它甚至在没有语句切换结束的情况下编译。你能提供
renderRoutes()的代码吗
你在哪里调用它?你在任何地方创建了实际的React路由器吗?如果没有相应的@Luze添加的代码,A将无法工作。你应该先声明路由。然后是路由。它甚至在没有语句切换结束的情况下编译。不,我忘记了在文章中添加结束标记,在代码中我没有错误,但是这个Logo.js组件位于上下文,不起作用不,我忘了在文章中添加结束标记,在代码中我没有错误,但这个Logo.js组件位于上下文中,不起作用