I am building an app using react flow library for a week or so and have a few questions.
How would you go about custom nodes that needs access to the state of the app?I keep the updated array of the nodes in the App component and my custom node has a function that adds a new node to the elements array. What I am doing now is passing a function via the data object when I create the node but then I need to update this function (assigning it again to the node) every time my elements array is updating, if I don’t do this the function calls to an earlier state of the array… I feel like there must be a better way to handle functions in custom nodes. How do you keep track of the node position?first, I tried to access flow state with useStoreState but it was giving me render problems so I ended updating elements on onDragStopped event. Any good practices there? How do you pass props to custom nodes, Like the first question but more specific because creating nodes in react flow is different that a ‘normal’ react application Any other suggestions when working with react flow? (tips and tricks…)