Skip to content

Instantly share code, notes, and snippets.

@esr360
Last active August 17, 2019 23:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esr360/1b8f09db2542e8a15c2a51285591dc59 to your computer and use it in GitHub Desktop.
Save esr360/1b8f09db2542e8a15c2a51285591dc59 to your computer and use it in GitHub Desktop.
import React, { useState, useContext } from 'react';
const styles = ({ props, state, context, theme }) => ({
...
});
const MyComponent = (props) => {
const [isActive, setActive] = useState(false);
return (
<Module styles={styles} isActive={isActive} onClick={() => setActive(!isActive)}>
<Component name='heading' strong>{props.heading}</Component>
<Component name='content'>{props.children}</Component>
</Module>
)
}
export default MyComponent;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment