Skip to content

Instantly share code, notes, and snippets.

@tommmyy
Created October 26, 2018 13:17
Show Gist options
  • Save tommmyy/54e2062db9060cddc6ab82c5309e3569 to your computer and use it in GitHub Desktop.
Save tommmyy/54e2062db9060cddc6ab82c5309e3569 to your computer and use it in GitHub Desktop.
import React, { useMemo } from 'react';
const Section = ({ heading, children }) => {
const headingChild = useMemo(() => <h1>{heading}</h1>, [heading]);
return (
<section>
{headingChild}
{children}
</section>
);
};
const PatternMemoChildren = () => <Section heading="Heading">Content.</Section>;
export default PatternMemoChildren;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment