Category : redux

I have a sub-store as info: {}, data: {}, items: [], I have created 3 actions to reset the above shown individual properties: resetInfo:action((state, payload) => { state.info = {}; }), resetData: action((state, payload) => { state.data = {}; }), resetItems:action((state, payload) => { state.items = []; }), I want to create another action let ..

Read more

index.js const [sendVia, setSendVia] = useState(‘astrolger’); const changeValue = (e) => { e.preventDefault(); console.log(e.target.value) setSendVia(e.target.value); }; const handleSubmit = async e => { e.preventDefault(); }; <div className=’row mt-2′> <div className=’col’ onChange={e => changeValue(e)}> <p>Send By:</p> <input type="radio" id="astrologer" name="sendBy" value="astrolger" /> <label htmlFor="astrologer" className=’ml-1′>Astrologer</label> <input type="radio" id="disciple" name="sendBy" value="disciple" className=’ml-2′ /> <label htmlFor="disciple" className=’ml-1′>Disciple</label><br /> ..

Read more

I get an error when using useRef() on a jsx element that toggles a drop down menu made with Material-UI. where I seem to get the error: const anchorRef = useRef() ……………………………. <Typography ref={anchorRef} className={classes.link} onClick={handleDropDown} > My Account </Typography> <Menu anchorEl={anchorRef.current} keepMounted open={droppedDown} onClose={handleDropDown} > I get this warning: Warning: findDOMNode is deprecated in ..

Read more

I am trying to convert a Redux-implementation to Typescript, but are having difficulties making our observeStore Utility-function typesafe. This is the original function: function observeStore(store, select, onChange) { let currentState; function handleChange() { let nextState = select(store.getState()); if (nextState !== currentState) { currentState = nextState; onChange(currentState); } } let unsubscribe = store.subscribe(handleChange); handleChange(); return unsubscribe; ..

Read more

I’m using redux-saga with takeEvery which allows multiple actions to execute simultaneously: export function* watchSaga() { yield all([ takeEvery(actionTypes.FETCH_DATA, fetchDataSaga) ]) } and the fetchDataSaga looks like: export function* fetchDataSaga(action) { yield put(actions.fetchDataStart()) try { const response = yield axios.post(url, body) yield put(actions.fetchDataSuccess(response.data)) } catch (error) { yield put(actions.fetchDataFail(error.response.data.error)) } } in fetchDataSuccess, I’m adding ..

Read more