We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Event handlers are still an experimental feature in the UIDL, but currently it supports stateChange and propCall as two different statements.
stateChange
propCall
"click": [ { "type": "stateChange", "modifies": "isExpanded", "newState": "$toggle" } ]
NOTE: $toggle is a special string we're looking for and abstracts the expression: state.key = !state.key it could be deprecated if we implement #295.
$toggle
state.key = !state.key
"click": [ { "type": "propCall", "calls": "onClose", "args": [] } ]
It would be a nice addition to be able to express a condition.
Consider this scenario: You want to change the a state key when a certain prop is being set. Example: increment stateValue when props.isActive is true
stateValue
props.isActive
true
handleClick() { if (this.props.isActive) { this.stateValue ++ } }
Another type of statement in the event handler:
"click": [ { "type": "condition", "when": <conditional expression>, "then": [ <statements> ] } ]
It can even support an else or a switch like statement later.
else
switch
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Context
Event handlers are still an experimental feature in the UIDL, but currently it supports
stateChange
andpropCall
as two different statements.NOTE:
$toggle
is a special string we're looking for and abstracts the expression:state.key = !state.key
it could be deprecated if we implement #295.Problem
It would be a nice addition to be able to express a condition.
Consider this scenario: You want to change the a state key when a certain prop is being set.
Example: increment
stateValue
whenprops.isActive
istrue
Solution
Another type of statement in the event handler:
It can even support an
else
or aswitch
like statement later.The text was updated successfully, but these errors were encountered: