** texto fuerte **
Quiero usar el valor de estado del reductor de compra en el reductor de cambio. ¿Cómo puedo acceder a eso?
import { createSlice } from "@reduxjs/toolkit"; export const cryptoSlice = createSlice({ name: "crypto", initialState: { coins: [], total: 0, }, reducers: { buy: (state, action) => { state.total += +action.payload.input; state.coins.length > 0 ? state.coins.map((coin) => { if (coin.cryptoCoin.id === action.payload.cryptoCoin.id) { coin.input = +action.payload.input + +coin.input; } else { state.coins.push(action.payload); } }) : state.coins.push(action.payload); }, exchange: (state, action) => { state.coins.push({ cryptoCoin: action.payload.exchangeItem, input: action.payload.input, }); console.log(state.coins); }, }, }); export const { buy, exchange } = cryptoSlice.actions; export default cryptoSlice.reducer;Entonces, este es mi reductor. Quiero usar el valor del estado de compra en mi reductor de intercambio