Replies: 1 comment 1 reply
-
the |
Beta Was this translation helpful? Give feedback.
1 reply
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.
Uh oh!
There was an error while loading. Please reload this page.
-
I made a component that used more than once some of the properties that were passed to it, that turned out to be a problem when I used it since I passed a computationally heavy value to one of those properties.
This is a minimalistic example (That can run on the solid playground) of that situation:
If you check the console you'll see that "computationally heavy" is printed 2 times instead of 1, a simple solution is to wrap it in a memo like so:
Since I needed to do that for a lot of components that used a lot of their props multiple times I came out with this function:
Which could be used like so:
Beta Was this translation helpful? Give feedback.
All reactions