Hello I am currently studying redux-toolkit. As the title, I'm curious about the difference between the two. I would appreciate it if you could let me know in which case result data goes into the payload and in which case it goes into the meta.
enter image description here enter image description here
const templateGetOne = createAsyncThunk('template/check/code', async (code) => {
const response = axios.get(`${api}/temp/info?template_code=${code}`)
const data = await response.data
console.log('response data>>>>', data)
return data
})
builder.addCase(templateGetOne.fulfilled, (state, action) => {
state.code = action.meta
console.log('state code: ', state.code)
console.log('action: ', action)
console.log('action payload: ', action.payload)
console.log('action meta: ', action.meta)
})
const handleCheck = (event) => {
dispatch(templateGetOne(event.target.value))
}
I'm guessing that maybe something went wrong in the process of passing the action and finding the reducer. However, I don't know the exact difference between the two and it's hard to figure out because I still don't understand the principle of how it works. Help