Replies: 0 comments 1 reply
|
This seems like a good idea to me. I'm doing some research to be sure that there is no big downside to this. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
The big issue with Lenra right now is the lack of client-side state.
For now, if we want to control a popup for example, we have to link the popup "open" state to a mongo document.
We could create a client-side state to manage this kind of cases.
My idea
A
statecomponent could be created by the developer to create a state around one or more components.This
statecomponent have anamethat can be used anywhere to get the data.Example :
{ "type": "state", "name": "myState", "init": { "open": false }, "child": { "type": "modal", "child": {...}, "open": "#myState.open" } }Now to manipulate this state, there is multiple options.
We can also add automatic client-side state like "hover", "focused" and so on. These are fully automatic and can only be read.
A (messy) example that need some work
{ "type": "state", "name": "myState", "init": { "open": false }, "child": { "type": "flex", "children": [{ "type": "modal", "child": {...}, "open": "#myState.flex.text.hover" }, { "type": "text", "value": "hover me !", "enableState": { "hover": true } }] } }All reactions