Additional things to consider, if someone wants to implement this:
1) If you are concern about variable type, you should make additional changes into useStickyState() by two ways: Detecting the variable inside the function or passing an additional arg (i.e: 'integer')
2) "The label you give it has to be unique", one option for that could be creating a Set outside the function, and control if that label is being created or not, and throw a warning in the code.
But that's too fancy and all, I really prefer your solution :)
And welcome to Dev.to ;)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Awesome post!!
Additional things to consider, if someone wants to implement this:
1) If you are concern about variable type, you should make additional changes into
useStickyState()
by two ways: Detecting the variable inside the function or passing an additional arg (i.e: 'integer')2) "The label you give it has to be unique", one option for that could be creating a Set outside the function, and control if that label is being created or not, and throw a warning in the code.
But that's too fancy and all, I really prefer your solution :)
And welcome to Dev.to ;)