Replies: 1 comment 2 replies
-
You can just use the Context API directly, you don't need the lib to export a provider itself. User code works just fine. There isn't an official recommendation, testing is very diverse. Use whatever works best for you & your team. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey there! Just wanted to start by saying I'm really liking the simplicity of this library – it's pretty cool.
I've been on a bit of a hunt online trying to find some best practices for testing signals, but no luck finding anything official. Got any tips or resources you could share?
We're in the process of checking out Jotai and Signals, considering a move away from Redux Toolkit. We're really into how straightforward Signals are, but hitting a bit of a snag with the lack of testing guidance.
Our packages for this exploration includes React 18, Testing Library, @preact/signals-react, and @preact/signals-react-transform.
Here’s what we’ve found and been thinking about:
theSignal.value = "something"
, but it ends up affecting all tests in that file. We can reset the signal with abeforeEach
for each test, but this seems cumbersome and not scalable. We are curious if there's a better way to handle it.Provider
.In a nut shell, setting it up in redux or Jotai looks something like this:
Thank you! Love your project ❤❤❤
Beta Was this translation helpful? Give feedback.
All reactions