快速路由器的反应路由器

时间:2018-11-05 08:29:02

标签: reactjs express react-router

嗨,我现在在用Express做网络反应示例。如果只启动没有表达的应用程序,它已经很好了。但是如果我将它与express一起使用,就会发生问题

反应路由器

export default () => {
return (
    <div>
        <Switch>
            <Route exact path="/" component={HomePage} />
            <Route exact path="/question" component={QuestionListPage} />

        </Switch>                                                   
    </div>
)}

表达问题路由器(/问题)

router.get('/', (req, res) => {
   ... // some code

   console.log('question get')
   setTimeout(() => {
       res.json(datas);
   }, 500)
})

当我使用Express + React应用刷新时,显示json对象而不是查看页面

此图片在刷新之前 enter image description here

在这之后 enter image description here

我该如何解决..?我该怎么办?请帮助我

0 个答案:

没有答案