Download dev.to-clone/src/store/post/currentPost.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 535 Bytes
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/dev.to-clone/src/store/post/currentPost.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset@f5071caa249115f3b590492f1c8eb471e02aae4b/dev.to-clone/src/store/post/currentPost.js
-
curl -L -o currentPost.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/f5071caa249115f3b590492f1c8eb471e02aae4b/dev.to-clone/src/store/post/currentPost.js
535 Bytes
| import { createSlice } from '@reduxjs/toolkit'; | |
| import { getItemFromLocalStorage } from '../../helper/localStorage'; | |
| const initialState = { | |
| currentPostData: getItemFromLocalStorage('postDataToManage') || null, | |
| }; | |
| const currentPostSlice = createSlice({ | |
| name: 'currentPost', | |
| initialState, | |
| reducers: { | |
| setCurrentPostData: (state, action) => { | |
| state.currentPostData = action.payload; | |
| }, | |
| }, | |
| }); | |
| export const { setCurrentPostData } = currentPostSlice.actions; | |
| export default currentPostSlice.reducer; | |