Skip to content
This repository was archived by the owner on Jun 4, 2024. It is now read-only.

Commit 11ef509

Browse files
committed
Added n_clicks_previous property to Button.
1 parent edab573 commit 11ef509

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: src/components/Button.react.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ const Button = (props) => {
88
onClick={() => {
99
if (props.setProps) props.setProps({n_clicks: props.n_clicks + 1});
1010
if (props.fireEvent) props.fireEvent({event: 'click'});
11+
if (props.setProps) props.setProps({n_clicks_previous: props.n_clicks + 1});
1112
}}
1213
{...props}
1314
>
@@ -24,7 +25,8 @@ const Button = (props) => {
2425
};
2526

2627
Button.defaultProps = {
27-
n_clicks: 0
28+
n_clicks: 0,
29+
n_clicks_previous: 0
2830
};
2931

3032
Button.propTypes = {
@@ -46,13 +48,19 @@ Button.propTypes = {
4648
*/
4749
'n_clicks': PropTypes.integer,
4850

51+
/**
52+
* An integer that represents the number of times
53+
* that this element has been clicked on prior to click event.
54+
*/
55+
'n_clicks_previous': PropTypes.integer,
56+
4957
/**
5058
* A unique identifier for the component, used to improve
5159
* performance by React.js while rendering components
5260
* See https://reactjs.org/docs/lists-and-keys.html for more info
5361
*/
5462
'key': PropTypes.string,
55-
63+
5664

5765
/**
5866
* The element should be automatically focused after the page loaded.
@@ -155,7 +163,7 @@ Button.propTypes = {
155163
'fireEvent': PropTypes.func,
156164

157165
'dashEvents': PropTypes.oneOf(['click'])
158-
166+
159167
};
160168

161169
export default Button;

0 commit comments

Comments
 (0)