我对保留关键字"this"的错误感到困惑.在我的React组件中,下面显示我从一个状态从我的主要组件"App.js"传递到我的"RecipeList.js"组件,然后映射数据并渲染每个RecipeItem组件.我只是不明白为什么我会收到这个错误
React.js - 语法错误:这是一个保留字
在render return方法中的RecipeList中调用错误; 如果有人能提供帮助那就太好了!
谢谢
App.js
//main imports
import React, { Component } from 'react';
//helper imports
import {Button} from 'reactstrap'
import RecipeItem from './components/RecipeItem';
import RecipeList from './components/RecipeList';
import './App.css';
const recipes = [
{
recipeName: 'Hamburger',
ingrediants: 'ground meat, seasoning'
},
{
recipeName: 'Crab Legs',
ingrediants: 'crab, Ole Bay seasoning,'
}
];
class App extends Component {
constructor(props){
super(props);
this.state = {
recipes
};
}
render() {
return (
<div className="App">
<div className = "container-fluid"> …
Run Code Online (Sandbox Code Playgroud)