Skip to content

Trying to create a custom hook that returns constant value functions

Notifications You must be signed in to change notification settings

0livare/hooks-fn-equality

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This project is intended to demonstrate the difficulties I'm having in creating a custom React hook that returns functions that maintain reference equality with every invocation of the hook.

Turns out, the problem wasn't with my use of useCallback, but instead with my use of enzyme's shallow() function for testing. See this StackOverflow question I asked.

It also serves as a decent example of how to nicely set up jest + enzyme testing for react. Check out the git history for a detailed step-by-step process.


You can run this project with:

yarn
yarn jest

About

Trying to create a custom hook that returns constant value functions

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published