Closed jacobbergdahl closed 2 years ago
There is now a handful of code that is duplicated between useFacetEffect
and useFacetLayoutEffect
. @MartinMoe and I had a discussion about whether we should extract parts of the code into shared functions. We could even combine certain tests or make parts of the implementation of the tests reusable between useFacetEffect
and useFacetLayoutEffect
.
We ended up deciding not to do so for now, however. We decided to prioritized keeping the code easily readable and to keep the logic between different functions completely separated, even if it is similar.
The name of the
useFacetEffect
function is slightly misleading in the current implementation, as it is actually using React'suseLayoutEffect
as an underlying function. Thus, we have renamed the function touseFacetLayoutEffect
and added a new function calleduseFacetEffect
in its place that actually uses React'suseEffect
.We have updated the documentation to reflect this change in a separate pull request (#31).