State Management of WinnetouJs Application
∯ Purpose
Controls app updates using mutables.
∯ Dynamic constructos
Use mutables to refresh constructos content.
Syntax
{mutable: name(string)}
Example
mutables.js
import {Winnetou} from 'winnetoujs';
import {profileCard} from './constructos/profile.js';
...
Winnetou.setMutable('nameMut','John')
profileCard({
name:{mutable: 'nameMut'},
age:'24'
}).create('#app');
Winnetou.setMutable('nameMut','Anna');
// now profileCard was updated to show Anna in name prop
Or use not persistent behavior.
mutables.js
import {Winnetou} from 'winnetoujs';
import {profileCard} from './constructos/profile.js';
...
let nameMut = Winnetou.initMutable('John')
profileCard({
name:{mutable: nameMut},
age:'24'
}).create('#app');
Winnetou.setMutable(nameMut, 'Anna', false);
// now profileCard was updated to show Anna in name prop
Custom state management system
Click here to go to documentation and see how to create a custom state management complete system with WinnetouJs with a real example.