🌍 Public
Viewing a saved revision (read-only)
ce56d2cfe0964d23b201af5812c04394
Simple Unidirectional Data Flow
This example demonstrates a simple unidirectional data flow pattern, using a counter that increments on button click. The current count is displayed in the DOM, and each click dispatches an INCREMENT action to a reducer function, which returns a new state object. The updated state is then passed to a render function that updates the text content of the counter element. The code uses vanilla JavaScript, with plain DOM methods like `getElementById` and `addEventListener` to handle interaction and rendering.
AI-generated descriptionUnidirectional dataflow example using vanilla javascript