Created
December 12, 2018 13:37
-
-
Save NigelGreenway/de993cc73bb4092e78d2037652b388c1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
type Prop = { | |
title: string, | |
content: Array<string> | |
}; | |
const MyComponentContent = ({title, content}: Prop): React.Node => ( | |
<> | |
<h1>{title}</h1> | |
{content.map( paragraph => <p>{paragraph}</p>)} | |
</> | |
); | |
export { MyComponentContent }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as React from 'react'; | |
import MyComponentContent from './MycomponentContent'; | |
type Prop = { | |
title: string, | |
children: React.ChildrenArray<React.Element<typeof MyComponentContent>> | |
}; | |
const MyComponentWrapper = ({title, children}: Prop): React.Node => ( | |
<> | |
<h1>{title}</h1> | |
{children} | |
</> | |
); | |
export { MyComponentWrapper }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment