【问题标题】:ReferenceError: Invalid left-hand side in assignment / syntax-errorReferenceError:赋值/语法错误中的左侧无效
【发布时间】:2021-09-21 14:19:06
【问题描述】:

我的论坛(博客)网站代码如下:

import { AUTH } from '../actionTypes/actionTypes';
import * as api from '../api';

export default signin (formData, history) = async (dispatch) => {
    try {
        const { data } = await api.signIn(formData);

        dispatch({ type: AUTH, data });

        history.push('/');
    } catch (error) {
        console.log(error);
    }
};

但我收到此错误,第 (4) 行:

“ReferenceError: 赋值左侧无效”

如何解决?

【问题讨论】:

  • 你想做什么?
  • “actions”中的“auth.js”用于登录和注册我的博客应用
  • 所以你试图破坏异步响应?
  • 您要导出什么? export default (formData, history) => async (dispatch) => {};export const signon = (formData, history) => async (dispatch) => {};。阅读documentation
  • 我通过 const 更改了默认值,并在登录后添加了“=”并且它有效!谢谢大家

标签: javascript syntax-error logic


【解决方案1】:

我通过 const 更改了默认值,并在登录后添加了“=”并且它起作用了!谢谢大家

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-04-26
    • 2012-07-26
    • 1970-01-01
    • 2023-04-01
    • 1970-01-01
    • 2013-09-07
    相关资源
    最近更新 更多