Skip to content

Feature request: a build of @preact/signals with no dependency on preact/hooks #670

@jakelazaroff

Description

@jakelazaroff

Since diving into Preact and @preact/signals, I find they're actually much nicer with class components than functional components — so much so that I'm not using hooks at all. Unfortunately, since @preact/signals depends on preact/hooks, the latter gets imported even though it's only a transitive dependency.

Looking at the source, it mostly doesn't rely on preact/hooks for "core" functionality (as in, not used for hooks wrappers like useSignal) except for the SignalValue component that binds signals to text nodes. I tried converting it to a class component; it doesn't pass the tests but seems to work in a toy app I threw together. (I think this would also require a new entrypoint, since preact/hooks's side effects prevent it from being tree shaken.)

Is this something you'd be interested in supporting? If so, I'm happy to try to open a PR. I realize it would only save 1–2kb gzipped, but since Preact is so small that actually ends up being a significant amount of the library's weight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions