我对React很陌生,正在尝试启动一个应用程序。在我的主要App.js文件中,我正在设置一些虚拟道具数据,以传递给子组件Schedule
。我试图使用箭头函数vs类或函数来创建组件。我确定我缺少一些非常基本的东西。我因缺少逗号而遇到了许多ESLint错误,并且“当前的Javascript版本不支持类型。”
App.js:
import React from 'react';
import PropTypes from 'prop-types';
import { render } from 'react-dom';
import Schedule from './components/home/SchedulePage';
const App = () => (
orders: [
{
id: 1,title: 'First Order',desc: 'This order is for .'
},{
id: 2,title: 'Second Order',{
id: 3,title: 'Third Order',{
id: 4,title: 'Fourth Order',{
id: 5,title: 'Fifth Order',desc: 'This order is for .'
}
]
return (
<div>
<Schedule/>
</div>
);
);
export default App;
我也不确定如何将orders
发送到Schedule
。