I'm curious why useConstant is used as opposed to just using useMemo?
Looks like they both cache the return value of a function(?)
cc. @Andarist
https://reactjs.org/docs/hooks-reference.html#usememo
You may rely on useMemo as a performance optimization, not as a semantic guarantee. In the future, React may choose to “forget” some previously memoized values and recalculate them on next render, e.g. to free memory for offscreen components. Write your code so that it still works without useMemo — and then add it to optimize performance.
We can't allow forgetting created service - we need it to be the same throughout the whole lifetime of a component.
Most helpful comment
https://reactjs.org/docs/hooks-reference.html#usememo
We can't allow forgetting created service - we need it to be the same throughout the whole lifetime of a component.