Comments (7)
I thought of that, but this kind of screws the replay thing. (AFAIK you can't serialize and then deserialize symbols.) I want to pass them around for devtools, localStorage persistence, etc.
from redux.
@gaearon I see what you mean, that is very true. For my use case it won't be a problem, and I've submitted a patch request for redux-logger here: LogRocket/redux-logger#106
(Sorry for spamming this particular issue, but I think it's useful for others looking to use Symbols).
from redux.
You can't take an array of actions that use symbols, serialise them to JSON, save to localStorage, and later deserialise and replay them in a different browser session.
from redux.
You're right you cannot deserialize a Symbol
. I've missed that point.
from redux.
I say let's keep them strings for now and revisit if there are ways to get around (de)serialization problem.
from redux.
I might be confused here, but what do you mean by "cannot deserialize a Symbol"?
const INCREMENT_COUNTER = Symbol('INCREMENT_COUNTER');
console.log(String(INCREMENT_COUNTER)); // Symbol(INCREMENT_COUNTER)
Wouldn't this be perfectly ideal for Redux? The ability to have identically named action types that are namespaced. I'm absolutely hating the fear that action types are overlapping since everything is global.
from redux.
I just tried using a Symbol and thankfully it works excellent with Redux! The only error that came up was with redux-logger, so I'll narrow down the error and submit a patch (if one isn't already there).
from redux.
Related Issues (20)
- [email protected]: Empty object check error HOT 4
- Math.random() usage HOT 3
- Instead of Why there should What HOT 1
- Missing link in Learning Resources -> Middleware
- updating redux from 5.0.0 to 5.0.1 Typescript errors HOT 18
- Could β plainβ class instances be stored in Redux store state. HOT 15
- Update copyright HOT 1
- Invalid external image link
- Small inconsistant in the docs: src/app/ or app/? HOT 2
- Redux core example app not working HOT 1
- Add combineSlices section to Code Splitting page
- doc not match in setup with nextjs HOT 1
- The wrong export in redux/examples/counter-ts/src/features/counter/counterSlice.ts HOT 1
- remove references to deprecated createStore
- Redux import type gone since upgrading to latest version with javascript (Next 14) HOT 5
- Should not set the useRef current value during rendering HOT 2
- Add first-party support for persistence to redux HOT 2
- Argument of type 'AsyncThunkAction<{ id: number; }, void, AsyncThunkConfig>' is not assignable to parameter of type 'UnknownAction'. HOT 1
- Include UMD build artifacts for latest release HOT 1
- [Docs] Normalizing State Shape: Normalizr no longer maintained HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from redux.