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
Uh oh!
There was an error while loading. Please reload this page.
-
This proposal is about an Idea I took from React and Solidjs.
The idea is to create a
effecthelper that will register a function callback that will be executed after everystate.setcall, 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.setcalls.Cons
state.setcalls inside aneffectfunction.effectfunction for every situation. The code can get more complex because the straighfoward way to solve that is by adding if and else branches insideeffectfunction.Beta Was this translation helpful? Give feedback.
All reactions