Class: Counters

Counters(props)

Keeps a reset button and a set of buttons for each counter.

Constructor

new Counters(props)

Class components always need to call the base constructor with props. Moreover, ES6 classes need to call super in case they are subclasses. Thus, if you wish to use it in the constructor, you need to pass it to super(). In case we omit it, we can always find props available inside render function.
Parameters:
Name Type Description
props Object component input.
Properties
Name Type Description
counters Array.<Object.<id:Number, value:Number>> array of counter objects.
onReset function callback to reset all counters.
onIncrement function callback to increment a counter.
onDecrement function callback to decrement a counter.
onDelete function callback to delete a counter.
Source:
See:

Extends

  • React.Component

Methods

render() → {HTMLDivElement}

Using a special prop called children to pass something between the opening and closing tag of an element. Counter could be self closed, but here we pass an <h6> tag.

This is useful when using dialog boxes to allow the consumer of that component to pass content to be rendered on the dialog box.
Source:
Returns:
a reset button plus a number of Counter components.
Type
HTMLDivElement