Let the card hold state
glenjamin opened this issue · 4 comments
glenjamin commented
Something like this:
defcard(
"state demo",
function(card) {
return <button onClick={() => card.setState(x => x + 1)>{card.state}</button>;
},
{ state: 123 }
)
Use a single argument function with properties to make future extensions easier
Like in react, setState
should accept an object to merge, or a function to apply to the current state.
part 2: If state is an atom, it should be subscribed to and the function re-rendered whenever it changes.
Yomguithereal commented
What does the inspect
param stands for?
glenjamin commented
What does the inspect param stands for?
Yomguithereal commented
Thanks. Sounds useful indeed.