A component helper type to define what a TreeView takes as a node renderer

Example

 type MyPayload = {
name: string
};

const MyNodeRenderer: TreeNodeComponent<SortedTree<MyPayload>> = ({ nodeKey, value, childKeys }) => {
return (<>
<div>{value.name}</div>
</>)
}

const App = () => {
const myTree = useSortedTree<MyPayload>();
return <TreeView value={myTree} renderer={MyNodeRenderer} />
}
interface TreeNodeComponent<T> {
    contextTypes?: ValidationMap<any>;
    defaultProps?: Partial<TreeNodeComponentProps<T>>;
    displayName?: string;
    propTypes?: WeakValidationMap<TreeNodeComponentProps<T>>;
}

Type Parameters

Properties

contextTypes?: ValidationMap<any>

Deprecated

use ComponentClass.contextType instead

Lets you specify which legacy context is consumed by this component.

See

Legacy React Docs

defaultProps?: Partial<TreeNodeComponentProps<T>>

Used to define default values for the props accepted by the component.

displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.

propTypes?: WeakValidationMap<TreeNodeComponentProps<T>>

Used to declare the types of the props accepted by the component. These types will be checked during rendering and in development only.

We recommend using TypeScript instead of checking prop types at runtime.