1

I just followed the steps to install react-dates to my project. I'm using their wrapper as a 'hello world' example but can't get it to run.

https://github.com/airbnb/react-dates/blob/master/examples/DateRangePickerWrapper.jsx

but on line 141 I'm getting the runtime error:

Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports. 
Check your code at DateRangePickerWrapper.jsx:141.
    in DateRangePickerWrapper (at GroupForm.js:253)
    in div (at GroupForm.js:204)
    in div (at GroupForm.js:201)
    in div (at FuseScrollbars.js:155)
    in FuseScrollbars (created by Connect(FuseScrollbars))
    in Connect(FuseScrollbars) (created by Route)
    in Route (created by withRouter(Connect(FuseScrollbars)))
    in withRouter(Connect(FuseScrollbars)) (created by 

I've tried not using the wrapper and simply importing and using DateRangePicker directly, Setting the parameters of the dates from strings to moment() to PropTypes null.

in my index.js I have import 'react-dates/initialize'; import 'react-dates/lib/css/_datepicker.css';

but I feel like I'm not getting it initialized correctly. Maybe my initialize import isn't being run and therefor it can't find the component name?

This is a project created with 'create-react-app'

  • are you using exact code from the link? How to you export DateRangePickerWrapper? line 7 suggests that you should use "export default" and not simple "export" for you component. – Sim Dim Nov 01 '18 at 21:07
  • I've simply hit save on the raw file and placed it in my project. The export is the final line of the file 'export default DateRangePickerWrapper;' I THINK it may have something to do with the import 'react-dates/initialize'; not being run properly? It's in my index.js at the root of my project though – Zachary O'Brien Nov 01 '18 at 21:10
  • my index.js has import 'react-dates/initialize'; import 'react-dates/lib/css/_datepicker.css'; import 'babel-polyfill' import 'typeface-muli'; ...more imports... ReactDOM.render( So I would think that'd be the right location – Zachary O'Brien Nov 01 '18 at 21:12

0 Answers0