Skip to content

Instantly share code, notes, and snippets.

@jahooma
jahooma / fast-children.tsx
Created October 9, 2019 06:40
A wrapper component that arranges children in a tree structure for faster and smarter updates.
export const FastChildren = memo((props: {
children: JSX.Element[]
}) => {
const changes = useChanges(props.children)
const tree = useChildrenTree(changes)
return <ChildrenTree tree={tree} />
})