Comments (3)
Hi @mrclay
The API for withUrlState
forces you to provide initial values for your state, in the color change example you can see this on the last line. I think this covers what you are suggesting with expected names / defaults.
Im not sure what you mean by validators, can you expand on that a little bit?
from use-url-state.
An attacker can easily send a user to a page with arbitrary querystring, which gets injected right into props. It should be safe, but I wouldn't gamble on it being harmless in all apps. Hopefully no one's dumb enough to render something from props.urlState as raw markup! OK, at least markup script injection isn't an issue.
from use-url-state.
That's a good point, at the moment the onus is on the user to make sure that they are validating what comes in from the query param. I will have a think about if this is best handled in the docs or by adding additional features.
from use-url-state.
Related Issues (13)
- An in-range update of query-string is breaking the build 🚨 HOT 1
- IE11 "Object doesn't support this action" HOT 7
- The order of Props and State in inconsistent between the readme and the code HOT 4
- Hooks? HOT 3
- Getting "window is not defined" when using custom history on SSR application HOT 1
- Change in v3 - clearing parameters from URL clears them from the state HOT 5
- Clear state from URL when empty/undefined/null HOT 3
- Should it work fine if I'm using HashRouter? HOT 4
- Demo link is broken HOT 1
- Warn the users who have sensitive info in their state HOT 6
- Confusion around initialState HOT 2
- Suggestion: Use the state to be pushed instead of what is called by setUrlState 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 use-url-state.