I have common react-components like Button, Checkbox, Datepicker etc.,. I am transpiling using the rollup.config.js. For date picker I am using react-datepicker. All these components are used in all the other create-react-app application.
For Datepicker, I am getting the below error,
Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `x`.
Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Check the render method of `x`.
at createFiberFromTypeAndProps (http://localhost:3000/static/js/bundle.js:80958:21)
at createFiberFromElement (http://localhost:3000/static/js/bundle.js:80979:19)
...
react-components/CustomDatePicker/CustomDatePicker.jsx
import React from 'react';
import DatePicker from 'react-datepicker';
export default function CustomDatePicker() {
return (
<DatePicker selected={new Date()} onChange={(date) => { }} />
);
}
react-palyground/Datepicker/Datepicker.jsx
import React from 'react';
import 'react-datepicker/dist/react-datepicker.module.css';
import { CustomDatePicker } from '[Organization-folder]/oneems-react-components';
export default function DatepickerElement() {
return (
<>
<h1>Datepicker</h1>
<CustomDatePicker />
</>
);
}
index.js
export { default as Datepicker } from "./DatePicker/DatePicker.jsx";
Can anyone help me to fix this issue?
Thanks in advance.