RubyLouvre / anu

the React16-compat library with hooks

Home Page:https://rubylouvre.github.io/anu/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

the second param of useEffect is invalid.

BetaSu opened this issue · comments

This is React:
https://codepen.io/anon/pen/rEJgMJ?editors=0011
This is Anujs:
https://codepen.io/anon/pen/OeQYzX?editors=0011

You can see , useEffect 's first param is called everytime when state change in Anujs.

version: 1.5.3

let nextInputs = Array.isArray(deps) ? deps : [create];
let prevState = updateQueue[key];
if (prevState) {
let prevInputs = prevState[1];
if (areHookInputsEqual(nextInputs, prevInputs)) {
return prevState[0];
}
}

It seems the problem is callback returned and push to update list array when prevDeps equals to nextDeps.