0

我在反应测试中收到此错误。我不知道为什么我仍然得到这个,我已经重新排序了我的钩子的顺序。

在此处输入图像描述

这是我的组件的顺序

const history = useHistory();

const [email, setEmail] = useState("");

const session = useSelector(state => state);

useEffect(() => {
    if (session.token === "user_created") {
      history.push("/login");
    }
  }, [history, session.token]);

useEffect(() => {
    if (session.error) {
      setErrors(session.error);
    }
  }, [session.error]);

const dispatch = useDispatch();
  const create = useCallback(
    ({ email, pass, full_name }) => dispatch(sact.create({ email, pass, full_name })),
    [dispatch],
  );

const validate = useCallback(() => )

const handleSubmit = useCallback(() => )

const handleChange = () => ()

return <div className="register-container"></>


4

0 回答 0