Environment
I'm using Typescript with react.
I've installed react-bootstrap-date-picker with yarn install react-bootstrap-date-picker
.
The website does not tell how to import the component.
Question
From looking at the installed node module (within the node_modules
folder), how do I figure out the import path of the component?
What I've tried
I tried import { DatePicker as BSDatePicker } from 'react-bootstrap-date-picker';
, but it errors out Could not find a declaration file for module 'react-bootstrap-date-picker'.
CodePudding user response:
Try default
import:
import DatePicker from 'react-bootstrap-date-picker';
CodePudding user response:
You are using curly braces which is not required. Try this
import DatePicker as BSDatePicker from 'react-bootstrap-date-picker';
Curly braces are used for normal imports (imports which are not default imports) while if we import something without curly braces, it means that it is default import.
Hope that this link will help you to understand further.
https://mindsers.blog/post/javascript-named-imports-vs-default-imports/