In reduxSlice
file, I am getting an error - 'curentamount' is not defined no-undef.
Redux slice:
import { createSlice } from '@reduxjs/toolkit'
export const addtoSlice = createSlice({
name: 'addto',
initialState: {
curentamount: 0,
},
reducers: {
incriment: (state) => {
state.curentamount = curentamount + 1
},
decriment: (state) => {
state.curentamount = curentamount - 1
},
},
})
export const { incriment, decriment } = addtoSlice.actions
export const selectadto = (state) => state.addtoSlice.curentamount
export default addtoSlice.reducer
React Component:
import React from 'react'
import addList from './features/auth/ads.json'
const Addtocart = () => {
return (
<div>
{addList.map((add) => (
<div key={add.id}>
<div> {add.addname}</div>
<div> {add.price}</div>
</div>
))}
</div>
)
}
export default Addtocart
Error Message:
Failed to compile.
src/features/auth/addtoSlice.js
Line 11:34: 'curentamount' is not defined no-undef
Line 14:34: 'curentamount' is not defined no-undef