Skip to content

infinite loop #80

@keeganstothert

Description

@keeganstothert
function DeleteScheduleForm() {
  const { someCondition, setSomeCondition} = useState();
  const { isLoading, run } = useAsync({
    deferFn: deleteSchedule,
  });

  useEffect(() => {
    if(!someCondition) return 

    run();
  }, [someCondition, run]);

  // ...
}

the useEffect requires run in the dependencies but this seems to be the cause of an infinite loop. the issue goes away if i ignore eslint and remove run from the list of dependencies

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions