'React' must be in scope when using JSX react/react-in-jsx-scope
Dung Do Tien Jan 24 2021 605
I have created a component in my react project, when I run the project I got an error 'React' must be in scope when using JSX react/react-in-jsx-scope
This is my component js file:
import Recipes from './Recipes';
const Navs = ({recipes}) => (
<article>
<header>
<h1>Recipes</h1>
</header>
<div className="recipes">
{recipes.map((recipe, i)=>
<Recipes key={i} {...recipe} />
)}
</div>
</article>
);
export default Navs;
Thanks for any solution.
Have 1 answer(s) found.
- N-4
Nguyen Truong Giang Jan 24 2021
Oh, you need to import
React
library into the head of your component:import React, { Component } from 'react';
* Type maximum 2000 characters.
* All comments have to wait approved before display.
* Please polite comment and respect questions and answers of others.