所以我有自定义组件class App
,但仍然有问题。我确信这很容易,但对于我这样的人来说,我并没有弄清楚。基本上,我的代码是:
(app.jsx):
import React from 'react';
import '../styles/index.scss';
const EventCalendar = require('react-event-calendar');
const events = [
{
start: '2015-07-20',
end: '2015-07-02',
eventClasses: 'optionalEvent',
title: 'test event',
description: 'This is a test description of an event',
},
{
start: '2015-07-19',
end: '2015-07-25',
title: 'test event',
description: 'This is a test description of an event',
data: 'you can add what ever random data you may want to use later',
},
];
export default class App extends React.Component {
render() {
return (
<div>
<h1>It Works!</h1>
<p>This React project just works including <span className="redBg">module</span> local styles.</p>
<p>Enjoy!</p>
<EventCalendar
month={7}
year={2017}
events={events}
onEventClick={(target, eventData, day)} => console.log(eventData)
/>
</div>
)
}
}
但是,当我运行时,出现此错误:
有人可以帮忙吗?
非常感谢。
更新:我按照建议修复了语法错误,当我试图用它来学习反应中的新东西时,我正在使用这个项目的示例项目,但现在得到这个,如屏幕截图所示: