handle textarea text state with redux and setText on example click

This commit is contained in:
Danny Avila 2023-02-08 09:59:01 -05:00
parent 581ee0e2ca
commit 5cd50e7826
4 changed files with 41 additions and 8 deletions

19
src/store/textSlice.js Normal file
View file

@ -0,0 +1,19 @@
import { createSlice } from '@reduxjs/toolkit';
const initialState = {
text: '',
};
const currentSlice = createSlice({
name: 'text',
initialState,
reducers: {
setText: (state, action) => {
state.text = action.payload;
},
}
});
export const { setText } = currentSlice.actions;
export default currentSlice.reducer;