How do I add more than 7 dependencies in React.useEffect?

I want to use more than 7 dependencies in React.useEffect and React.useMemo. Currently I have to use multiple useEffects doing the same thing due to the limitation of the dependency array. Is there a better way to implement this?

you can maintain your own binding by adding an 8th argument here:

@module("react")
external useEffect7: (
  @uncurry (unit => option<unit => unit>),
  ('a, 'b, 'c, 'd, 'e, 'f, 'g),
) => unit = "useEffect"

Are you sure you need seven reasons to run an effect???

2 Likes

This works, thanks!
I have a form which updates a preview in realtime and I want to pass all the form field values as dependencies.