As a newcomer to Typescript
, I am facing an issue while trying to import a react-bootstrap Button
.
In scenario 1:
import {Button} from 'react-bootstrap/lib/Button'
In scenario 2:
import * as Button from 'react-bootstrap/lib/Button'
Both methods do not result in any errors during the import statement, but encounter errors when trying to render the Button using
<Button bsClass="glyphicon glyphicon-new-window"></Button>
In scenario 1, there is no compile time error but it shows that Button is undefined
In scenario 2, Typescript displays the following compile time error
TS2604: JSX element type 'Button' does not have any construct or call signatures.
In contrast, the same operation works in JavaScript with
import Button from 'react-bootstrap/lib/Button'
. I am puzzled as to why none of the methods are working and what distinguishes these two approaches?