Home > Software design >  Getting error SyntaxError: Missing semicolon
Getting error SyntaxError: Missing semicolon

Time:12-08

Checked the code and cannot find where I need to put a semicolon. Here is error. Here is the code.

CodePudding user response:

It should be

const Routes = (props) => (
...
)

CodePudding user response:

It should be like this

const Routes = (props) => ( ... )

CodePudding user response:

It should be like this

const PropsPage = () => {  return (    <h3>Props Page</h3>  );};

for a

const App = () => {
  return (
    <section className="App">
      <Router>
        ...
        <Link to="/404-not-found">404</Link>
        <Link to="/props">Passing Props</Link>        <Switch>
          ...
          <Route exact path="/props" component={PropsPage} />          <Route component={NoMatchPage} />
        </Switch>
      </Router>
      <a href="/about">about with browser reload</a>
    </section>
  );
};

Passing function as a component props in Route component

const PropsPage = ({ title }) => {
  return (
    <h3>{title}</h3>
  );
};
  • Related