question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot read property 'momentLocalizer' of undefined

See original GitHub issue

In 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:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:13 (3 by maintainers)

github_iconTop GitHub Comments

9reactions
raoufswecommented, Dec 18, 2019

changing the import from import BigCalendar from "react-big-calendar"; to import { Calendar, momentLocalizer } from "react-big-calendar"; has fixed the problem in my case.

7reactions
PzYoncommented, Nov 29, 2018

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found