| Tech | Version |
|---------------------|---------|
| material-ui-pickers |2.0.4 |
| material-ui |@material-ui/[email protected] |
| React |16.6.3 |
| Browser |Chrome v70.0.3538.110|
| Peer library |[email protected], @date-io/[email protected]|
<MuiPickersUtilsProvider utils={DateFnsUtils} /> to top-level component<InlineDatePicker onChange={console.log} value={new Date()} /> somewhere in app Can not find utils in context.
You either a) forgot to wrap your component tree in MuiPickersUtilsProvider;
or b) mixed named and direct file imports.
Recommendation: use named imports from the module index.
It rendered a basic inline datepicker.
I get an error, see above.
I've created a basic CodeSandbox that (should) use the most up-to-date versions of all the libraries.
Basic CodeSandbox
I can't get anything to work with this basic setup, it is not just the InlineDatePicker that is faulty. I also tried using the basic DatePicker component, (because I wanted to copy the "Integration with Formik" guide), but its propTypes stated that it needed an utils prop that I couldn't find mentioned anywhere in the docs. Let me know if you need more information from me.
Thanks!
oh THAT was what it meant, thanks! I confused it with "named" and "default" imports, and made absolutely sure that I wasn't using any default imports.
Sorry for the inconvenience, thanks for the help!
Most helpful comment
Do not mix direct and named imports
https://codesandbox.io/s/r405k1w8yn