Replies: 1 comment
-
No reason why to complicate like this, and also I'm wondering if this is somehow falling into the same issues that modern frameworks creates for themselves. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This proposal is about an Idea I took from React and Solidjs.
The idea is to create a
effect
helper that will register a function callback that will be executed after everystate.set
call, or in other words, after the state is changed.Use Case
The example below shows a pretty common case where you want to save some information or send it to an api call when state is changed.
Pros
state.set
calls.Cons
state.set
calls inside aneffect
function.effect
function for every situation. The code can get more complex because the straighfoward way to solve that is by adding if and else branches insideeffect
function.Beta Was this translation helpful? Give feedback.
All reactions