Skip to content

Commit

Permalink
Change the content of the fragments file
Browse files Browse the repository at this point in the history
  • Loading branch information
aeltanawy committed Sep 18, 2023
1 parent e9bd5e6 commit 7369210
Showing 1 changed file with 5 additions and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,41 +1,5 @@
import React from 'react';
import PropTypes from 'prop-types';
import {defaultProps, propTypes} from '../components/{{cookiecutter.component_name}}.react';

/**
* ExampleComponent is an example component.
* It takes a property, `label`, and
* displays it.
* It renders an input with the property `value`
* which is editable by the user.
*/
const {{cookiecutter.component_name}} = (props) => {
const {id, label, setProps, value} = props;

return (
<div id={id}>
ExampleComponent: {label}&nbsp;
<input
value={value}
onChange={
/*
* Send the new value to the parent component.
* setProps is a prop that is automatically supplied
* by dash's front-end ("dash-renderer").
* In a Dash app, this will update the component's
* props and send the data back to the Python Dash
* app server if a callback uses the modified prop as
* Input or State.
*/
e => setProps({ value: e.target.value })
}
/>
</div>
);
}


{{cookiecutter.component_name}}.defaultProps = defaultProps;
{{cookiecutter.component_name}}.propTypes = propTypes;

export default {{cookiecutter.component_name}};
{% if cookiecutter.component_type == "Function Component" -%}
{%- include 'cookiecutter_templates/FunctionComponent.react.js' -%}
{%- else -%}
{%- include 'cookiecutter_templates/ClassComponent.react.js' -%}
{%- endif -%}

0 comments on commit 7369210

Please sign in to comment.