This repository was archived by the owner on Jun 4, 2024. It is now read-only.
File tree 1 file changed +11
-3
lines changed
1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ const Button = (props) => {
8
8
onClick = { ( ) => {
9
9
if ( props . setProps ) props . setProps ( { n_clicks : props . n_clicks + 1 } ) ;
10
10
if ( props . fireEvent ) props . fireEvent ( { event : 'click' } ) ;
11
+ if ( props . setProps ) props . setProps ( { n_clicks_previous : props . n_clicks + 1 } ) ;
11
12
} }
12
13
{ ...props }
13
14
>
@@ -24,7 +25,8 @@ const Button = (props) => {
24
25
} ;
25
26
26
27
Button . defaultProps = {
27
- n_clicks : 0
28
+ n_clicks : 0 ,
29
+ n_clicks_previous : 0
28
30
} ;
29
31
30
32
Button . propTypes = {
@@ -46,13 +48,19 @@ Button.propTypes = {
46
48
*/
47
49
'n_clicks' : PropTypes . integer ,
48
50
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
+
49
57
/**
50
58
* A unique identifier for the component, used to improve
51
59
* performance by React.js while rendering components
52
60
* See https://reactjs.org/docs/lists-and-keys.html for more info
53
61
*/
54
62
'key' : PropTypes . string ,
55
-
63
+
56
64
57
65
/**
58
66
* The element should be automatically focused after the page loaded.
@@ -155,7 +163,7 @@ Button.propTypes = {
155
163
'fireEvent' : PropTypes . func ,
156
164
157
165
'dashEvents' : PropTypes . oneOf ( [ 'click' ] )
158
-
166
+
159
167
} ;
160
168
161
169
export default Button ;
You can’t perform that action at this time.
0 commit comments