DEV Community

Discussion on: React Hooks Factories

Collapse
 
lyrod profile image
Lyrod • Edited

Very good post.

One problem and one improvement

  1. Factory class, you did Factory.getUser but getUser is not static, or you don't create factory via "new".

  2. you could use useCallback instead in the Shared state example at "memoize the function"

Collapse
 
pietmichal profile image
Michał Pietraszko

Thanks for catching this! I've updated the examples.

The interesting thing is that useCallback or useMemo is not actually needed.

Collapse
 
havespacesuit profile image
Eric Sundquist

One more catch - useUppercasedString listed twice, instead of useLowercasedString the second time.

Thread Thread
 
pietmichal profile image
Michał Pietraszko

Fixed :D