You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2025. It is now read-only.
New here, trying to migrate somethings from redux to recoil.
Is there a way to update a Atom from a Midleware?, the problem" Hooks can only be called inside of the body of a function component.", the code is more or less like..
//Define my atomFamily from a selector fetching an API
export const instrumentState = atomFamily({
key: 'instrument',
default: selectorFamily({
key: "listAtom/Default",
get: (id) => ({ get }) => {
const d = useRecoilValue(instrumentsState)
return d[id]
}
})
})
export const signalRMiddleware = storeAPI => next => action => {
switch (true) {
case startConnection.match(action): {
startWebSocket(); //Start the connection...
hubConnection.on("ReceiveMessage", (user, data, channel) => {
switch (channel) {
case 'TypeOfMessage':
{
//For each message I recieved I try to modify the atom, it's hardcoded just for testing
const [instrument, setInstrument] = useRecoilState(instrumentState(10))
setInstrument({ ...instrument, price: 9 })
}
}
}
}
}
The text was updated successfully, but these errors were encountered:
New here, trying to migrate somethings from redux to recoil.
Is there a way to update a Atom from a Midleware?, the problem" Hooks can only be called inside of the body of a function component.", the code is more or less like..
The text was updated successfully, but these errors were encountered: