问题描述
const removeCart = (productId) => (dispatch) => {
dispatch({ type: CART_REMOVE_ITEM,payload=productId})
}
export default removeCart
export { addToCart }
正在将其导出为减速器的动作。 我将其导入为
import removeCart,{ addToCart } from '../actions/cartActions';
但是我收到此错误“尝试导入错误:'../ actions / cartActions'不包含默认导出(导入为'removeCart')。”
该路由是正确的,因为我已经在使用同一文件中的其他操作。
解决方法
不要在命名的出口处加上括号。
只是:
/// - namespace: The namespace in which defines the `id`. New
/// namespaces are created by adding an `@Namespace()` variable
/// to a ``View`` type and reading its value in the view's body
/// method.
/// - properties: The properties to copy from the source view.
/// - anchor: The relative location in the view used to produce
/// its shared position value.
/// - isSource: True if the view should be used as the source of
/// geometry for other views in the group.
///
/// - Returns: A new view that defines an entry in the global
/// database of views synchronizing their geometry.
///
@inlinable public func matchedGeometryEffect<ID>(id: ID,in namespace: Namespace.ID,// << here !!
properties: MatchedGeometryProperties = .frame,anchor: UnitPoint = .center,isSource: Bool = true) -> some View where ID : Hashable