mweststrate / use-st8

Single-function alternative for React.useState
MIT License
234 stars 7 forks source link

Doesn't work with create-react-app #5

Closed myleftshoe closed 4 years ago

myleftshoe commented 5 years ago

I think mjs support was removed from cra, i'm getting this error:

./node_modules/use-st8/lib/index.mjs
Can't import the named export 'useState' from non EcmaScript module (only default export is available)
mweststrate commented 5 years ago

The error seems to suggest that your import statement is wrong, please check it, or share your code if you can't find the problem....

On Tue, Mar 12, 2019 at 6:45 AM myleftshoe notifications@github.com wrote:

I think mjs support was removed from cra, i'm getting this error:

./node_modules/use-st8/lib/index.mjs Can't import the named export 'useState' from non EcmaScript module (only default export is available)

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mweststrate/use-st8/issues/5, or mute the thread https://github.com/notifications/unsubscribe-auth/ABvGhJjNZT1siNl_TD7FLt4gBsVekeQaks5vVz8GgaJpZM4bqHLl .

Obiwarn commented 4 years ago

um..same error here... I use

import useSt8 from "use-st8";

when I try the suggested:

import { useSt8 } from "use-st8";

my IDE throws: TS2614: Module '"../../../../node_modules/use-st8/lib"' has no exported member 'useSt8'. Did you mean to use 'import useSt8 from "../../../../node_modules/use-st8/lib"' instead?