A stopwatch app constructed using d3-component.
The following components are defined and used to construct the app:
app
The top-level app component. This serves as a “container component” that holds the state of the app, and exposes “actions” to children (similar pattern to Redux. This component manages an instance of d3-timer that keeps track of passing time.
buttonPanel
The panel that contains the two buttons. This shows a simple composition pattern in which props are passed through to child components.
resetButton
The button that says “Reset” and invokes the reset
action when clicked.
startStopButton
The button that either starts or stops (pauses) the stopwatch when clicked, depending on whether the stopwatch is running or not.
button
A generic Button component, used by both resetButton
and startStopButton
.
timeDisplay
A display of the current time.
Built with blockbuilder.org
forked from curran‘s block: Posts with d3-component