首页 > 解决方案 > ReferenceError:赋值/语法错误中的左侧无效

问题描述

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

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:分配中的左侧无效”

如何解决?

标签: javascriptsyntax-errorlogic

解决方案


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


推荐阅读