Can you use es6 import alias syntax for React Components?

前端 未结 6 1904
抹茶落季
抹茶落季 2021-01-30 12:35

I\'m trying to do something like the following, however it returns null:

import { Button as styledButton } from \'component-library\'

then atte

6条回答
  •  北海茫月
    2021-01-30 13:31

    User-Defined Components Must Be Capitalized
    https://reactjs.org/docs/jsx-in-depth.html#user-defined-components-must-be-capitalized

    change your code to

    import { Button as StyledButton } from 'component-library';
    ....bah...bah....bah  
    
    

提交回复
热议问题