preactjs / signals

Manage state with style in every framework
https://preactjs.com/blog/introducing-signals/
MIT License
3.63k stars 88 forks source link

@preact/signals-react@2.0.0 not re-exporting useSignals #473

Closed JonAbrams closed 3 months ago

JonAbrams commented 6 months ago

According to the docs, I should be able to import { useSignals } from '@preact/signals-react', but since useSignals is not re-exported, I need to do this instead: import { useSignals } from '@preact/signals-react/runtime'.

XantreDev commented 6 months ago

I think it's better to just replace @preact/signals-react -> @preact/signals-react/runtime in README.md

XantreDev commented 6 months ago

472 Like that

JonAbrams commented 6 months ago

Seems inconsistent to re-export useSignal but not useSignals from the same place.

XantreDev commented 6 months ago

What is the problem to import it from runtime? It's logically little bit different stuff

JonAbrams commented 6 months ago

Adds an extra import statement, for no reason. It’s just cleaner to have all of a modules exports in one place.

On Fri, Dec 22, 2023 at 14:25 Valerii Smirnov @.***> wrote:

What is the problem to import it from runtime? It's logically little bit different stuff

β€” Reply to this email directly, view it on GitHub https://github.com/preactjs/signals/issues/473#issuecomment-1868106127, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJPPVAV2JOUYM44DVW2F53YKYCFXAVCNFSM6AAAAABA7M4NL2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNRYGEYDMMJSG4 . You are receiving this because you authored the thread.Message ID: @.***>

rschristian commented 6 months ago

Cleanliness isn't so much relevant as intended default usage -- useSignals being exported from a subpath (/runtime) would indicate it's more of an "opt-in" than a default.

Not 100% sure what Andre had meant for though. @andrewiggins friendly ping if you're not too busy with holiday stuff

dotte1 commented 6 months ago

Yes please fix the README for those of us too lazy to read the Issues πŸ˜†. I'm a brand new user of @preact/signals in a React project, so this was a bit of head scratcher at first wondering why things weren't working, uh, reactively...also, my project doesn't use Babel.

Anyway, keep up the good work and thanks for the clarifications, everyone πŸ‘

Merri commented 4 months ago

I think it's better to just replace @preact/signals-react -> @preact/signals-react/runtime in README.md

Just noting here that readme on npm site still shows outdated documentation.

XantreDev commented 4 months ago

I think it's better to just replace @preact/signals-react -> @preact/signals-react/runtime in README.md

Just noting here that readme on npm site still shows outdated documentation.

It will be updated with the next release. It is possible to release it with only changes in readme, too