Cannot read property 'momentLocalizer' of undefined
See original GitHub issueIn my project I am trying to initialize react-big-calendar but it’s saying that it doesn’t exist.
my package versions: “react-dom”: “16.2.0”, “react-big-calendar”: “^0.20.1”, “moment”: “^2.22.2”,
Why I can’t use the solution below? Something was changed in version 0.20?
BigCalendar.setLocalizer(BigCalendar.momentLocalizer(moment));
Because:
Property 'setLocalizer' does not exist on type 'typeof BigCalendar'.
And
Property 'localizer' is missing in type '{ events: any[]; }'.
Does anyone have any solutions to these problems?
Issue Analytics
- State:
- Created 5 years ago
- Reactions:3
- Comments:13 (3 by maintainers)
Top Results From Across the Web
Cannot read property 'momentLocalizer' of undefined - React ...
I had the same problem: import moment from 'moment'; import { Calendar, momentLocalizer } from 'react-big-calendar'; ...
Read more >[Solved]-Cannot read property 'momentLocalizer' of undefined
Coding example for the question Cannot read property 'momentLocalizer' of undefined - React Big Calendar-Reactjs.
Read more >react-big-calendar - npm
Calendar! with events. Latest version: 1.5.2, last published: 2 months ago. Start using react-big-calendar in your project by running `npm i ...
Read more >How to Read React Errors (fix 'Cannot read property of ...
Got an error like this in your React component? Cannot read property `map` of undefined. In this post we'll talk about how to...
Read more >How to use the react-big-calendar.momentLocalizer function ...
props; const localizer = BigCalendar.momentLocalizer(moment); const events = [ //sample traffic { show_details: { guests: [null] ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
changing the import from
import BigCalendar from "react-big-calendar";
toimport { Calendar, momentLocalizer } from "react-big-calendar";
has fixed the problem in my case.I get the same error using following dependencies:
"react-big-calendar": "0.20.2"
"@types/react-big-calendar": "0.20.1"
"typescript": "3.1.6"
I import BigCalendar as follows:
import BigCalendar from "react-big-calendar";
And then use it like this:
const momentLocalizer = BigCalendar.momentLocalizer(moment);
Error:
Uncaught (in promise) TypeError: Cannot read property 'momentLocalizer' of undefined