期望一个赋值或函数调用,而是看到一个表达式reactjs

时间:2018-01-02 20:26:52

标签: reactjs react-redux

我遇到了上述错误。这是针对以下代码的App.js文件。我怎样才能摆脱这个错误?

import React from 'react';
import { BrowserRouter, Route } from 'react-router-dom';
import Header from './Header';

const Dashboard = () =>{ <h2> Dashboard </h2>};

const SurveyNew = () =>{ <h2> SurveyNew </h2>};

const Landing = () =>{<h2> Landing </h2>};

const App = () => {
        return (
            <div className="container">
                <BrowserRouter>
                    <div>
                    <Header />
                    <Route exact path="/" component = {Landing} />
                    <Route exact path="/surveys" component= {Dashboard} />
                    <Route path="/surveys/new" component= {SurveyNew} /> 
                    </div>
                </BrowserRouter>
            </div>
        );
};

export default App;

1 个答案:

答案 0 :(得分:0)

我的App.js

中的一些愚蠢代码也收到了以下警告

[1] Line 6: Expected an assignment or function call and instead saw an expression

我已将该表达式重构为赋值,并通过从表达式中删除{来修复我的问题。