#useMemo when create new NodeType

1 messages · Page 1 of 1 (latest)

shadow schooner
#
function ChatbotFlow () {

    // Import custom nodes and handle states
    const nodeTypes = useMemo(() => ({ startNode: StartNode, conditionNode: ConditionNode, msgNode: MsgNode, endNode: EndNode}), []);

As shown above I've already used useMemo to handle new Nodes and I have no idea why that warning still shows. Thank you 🥹

neon dagger
#

In react useMemo runs twice in strict mode. this happens to help you uncover bugs where the callback performs side effects (which it shouldnt). so the takeaway is:

  • this is normal behaviour
  • you can ignore this warning in dev
  • you wont see this warning in prod