calendar doesn't display on webpage
i everything else works as i've tested other reusable components in this instance
Uncaught TypeError: Cannot read property 'filter' of undefined
this is my component file (Counter.js):
React, { Component } from 'react';
// import BigCalendar from './BigCalendar' ;
import BigCalendar from 'react-big-calendar';
import moment from 'moment';
BigCalendar.momentLocalizer(moment);
export class Counter extends React.Component {
constructor(props) {
super(props);
this.state = {count: props.initialCount};
}
tick() {
this.setState({count: this.state.count + 1});
}
render() {
return (
<div>
<BigCalendar
defaultDate={new Date(2015, 3, 1)}
/>
</div>
);
}
}
export default Counter;
------------------------this is my index.js file--------------------------------
import React from 'react';
import ReactDOM from 'react-dom';
import Counter from './Counter';
ReactDOM.render(
React.createElement(Counter),
document.getElementById('mount')
);
---------------webpack.config.js-------------
path = require('path');
var projectRoot = __dirname;
var config = {
// Must be an absolute path or watching feature will fail
context: path.join(projectRoot, 'js'),
entry: './index.js',
output: {
path: path.join(projectRoot, 'html'),
filename: 'bundle.js',
},
module: {
loaders: [
{ test: /.js$/, exclude: /node_modules/, loader: 'babel-loader'},
],
},
resolveLoader: {
root: [
path.join(projectRoot, 'node_modules'),
],
},
resolve: {
root: [
path.join(projectRoot, 'node_modules'),
],
},
};
module.exports = config;
its actually import React, { Component } from 'react'; at top of Component.js
You need to give the BigCalendar events prop even if there are no events
For example:
<BigCalendar
events={[]}
// other props...
/>
ok thks
On Tue, May 31, 2016 at 11:34 PM, tpmh31292 [email protected]
wrote:
You need to give the BigCalendar events prop even if there are no events
For example:
events={[]}
// other props...
/>—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/intljusticemission/react-big-calendar/issues/105#issuecomment-222884165,
or mute the thread
https://github.com/notifications/unsubscribe/ALBp0-q7bHrFgD2JwsvmpfMp--7M7LObks5qHP3GgaJpZM4IrJ8t
.
Hi @jquense , do you think we should mark events as a required prop? I've just tried this today, and if I don't provide events nothing appear, even other part of my app, and no error is logged in console too.
Hi, I have a similar problem, events not marked as _required_ in docs, But when you don't pass it, You will get an error. So I think it should be marked as _required_
You need to give the BigCalendar
eventsprop even if there are no events
For example:<BigCalendar events={[]} // other props... />
Great! Solved the issue.Thanks
Most helpful comment
You need to give the BigCalendar
eventsprop even if there are no eventsFor example: