@matthewgapp/solidjs-flow
Version:
React Flow - A highly customizable React library for building node-based editors and interactive flow charts.
16 lines (13 loc) • 461 B
text/typescript
import { useStore } from './useStore';
import type { InternalNode, Node } from '../types';
/**
* Hook for getting an internal node by id
*
* @public
* @param id - id of the node
* @returns array with visible node ids
*/
export function useInternalNode<NodeType extends Node = Node>(id: string): () => InternalNode<NodeType> | undefined {
const node = useStore((s) => () => s.nodeLookup.get(id) as InternalNode<NodeType> | undefined);
return node;
}