Skip to content

Instantly share code, notes, and snippets.

@NigelGreenway
Created December 12, 2018 13:37
Show Gist options
  • Save NigelGreenway/de993cc73bb4092e78d2037652b388c1 to your computer and use it in GitHub Desktop.
Save NigelGreenway/de993cc73bb4092e78d2037652b388c1 to your computer and use it in GitHub Desktop.
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 };
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