2

I'm a total React-flow noob and this question might be silly, but I can't quite seem to grasp the concepts I need to utilize.

I'm trying to make an app where the user can add custom color nodes and then also add text nodes which, when connected show the color of the "source" node. I got a barebones version working using state. But this has a few problems. First off, currently only one color node works, but that could be fixed with a loop. The main issues is that I have no way to check if the text card is connected. Here's a codesandbox link to my attempt:

https://codesandbox.io/s/react-flow-add-node-button-forked-dj1rr1?file=/src/App.js

And an image to illustrate the issue:

enter image description here

I think I need to use the usStore hook instead of useState to manage all this stuff and be able to check if the nodes are connected, but I'm at a loss. Any help is greatly appreciated .

jansmolders86
  • 5,449
  • 8
  • 37
  • 51

0 Answers0