MENU

Memorized useSelector() in TypeScript

0
669
0

Sometimes, I needed to make selectors memorized for the performance, while working with Redux.

Yeah, performance, you should probably think about it at least once.

React.js looks very easy, JavaScript, Components, Virtual DOM, bla bla bla…

But actually, it isn’t such easy. If you write codes with empty brain, then the app works, but it won’t be fast never.

There are many cases where we can optimize codes.

Here is an example to memorize useSelector() hook.

And as always, I prefer the way in TypeScript. If you need a JavaScript version? oh, come on, should I put that as well? ?

Oh!, I forgot to put an example of usage.

Here you go!

Thank you!

Sorry, the comment form is closed at this time.