1
- import React , { Component } from 'react' ;
1
+ import React from 'react' ;
2
2
import PropTypes from 'prop-types' ;
3
3
import { defaultProps , propTypes } from '../components/{{cookiecutter.component_name}}.react' ;
4
4
@@ -9,33 +9,33 @@ import {defaultProps, propTypes} from '../components/{{cookiecutter.component_na
9
9
* It renders an input with the property `value`
10
10
* which is editable by the user.
11
11
*/
12
- export default class { { cookiecutter . component_name } } extends Component {
13
- render ( ) {
14
- const { id, label, setProps, value} = this . props ;
12
+ const { { cookiecutter . component_name} } = ( props ) => {
13
+ const { id, label, setProps, value} = props ;
15
14
16
- return (
17
- < div id = { id } >
18
- ExampleComponent: { label }
19
- < input
20
- value = { value }
21
- onChange = {
22
- /*
23
- * Send the new value to the parent component.
24
- * setProps is a prop that is automatically supplied
25
- * by dash's front-end ("dash-renderer").
26
- * In a Dash app, this will update the component's
27
- * props and send the data back to the Python Dash
28
- * app server if a callback uses the modified prop as
29
- * Input or State.
30
- */
31
- e => setProps ( { value : e . target . value } )
32
- }
33
- />
34
- </ div >
35
- ) ;
36
- }
15
+ return (
16
+ < div id = { id } >
17
+ ExampleComponent: { label }
18
+ < input
19
+ value = { value }
20
+ onChange = {
21
+ /*
22
+ * Send the new value to the parent component.
23
+ * setProps is a prop that is automatically supplied
24
+ * by dash's front-end ("dash-renderer").
25
+ * In a Dash app, this will update the component's
26
+ * props and send the data back to the Python Dash
27
+ * app server if a callback uses the modified prop as
28
+ * Input or State.
29
+ */
30
+ e => setProps ( { value : e . target . value } )
31
+ }
32
+ />
33
+ </ div >
34
+ ) ;
37
35
}
38
36
39
37
40
38
{ { cookiecutter . component_name } } . defaultProps = defaultProps ;
41
- { { cookiecutter . component_name } } . propTypes = propTypes ;
39
+ { { cookiecutter . component_name } } . propTypes = propTypes ;
40
+
41
+ export default { { cookiecutter . component_name} } ;
0 commit comments