-
-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce react-utils package #627
base: main
Are you sure you want to change the base?
Conversation
✅ Deploy Preview for preact-signals-demo ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
8e3c3a6
to
9553208
Compare
🦋 Changeset detectedLatest commit: a278750 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
9553208
to
0a31ce9
Compare
|
||
export function For<T>(props: ForProps<T>): JSX.Element | null { | ||
useSignals(); | ||
const cache = useMemo(() => new Map(), []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might need to switch this to a WeakMap when we see the first item being an object or leverage JSON.stringify on objects
0a31ce9
to
1134132
Compare
1134132
to
0df78b9
Compare
Size Change: 0 B Total Size: 83.3 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I might've missed something but is there a particular reason we're offering these specifically and only for React?
|
||
interface ShowProps<T = boolean> { | ||
when: Signal<T> | ReadonlySignal<T>; | ||
fallback?: JSX.Element; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we need to switch to importing JSX
, it's (finally!) no longer a global in React 19 AFAIK. It should exist on the React namespace back to 16.
@rschristian we will offer it for both but started out with React as the 2.0 release was pending |
This adds some common utilities for leveraging JSX with signals, I tried to stay in line with how
solid
provides JSX utils.