Redux and libraries with state (cytoscape)

Viewed 934

I have a particular problem with react, redux and a library which has it's own state and would like to know what is considered the best solution:

I have a form wizard with 3 steps (general information, advanced information, a graph which the user draws (cytoscape))

Component wise I have a Wizard component which decides which form to render, as well as forward and backward buttons. And a component for each step.

Problem: The last form has it's own state in cytoscape.js and I need when the user is finished and presses the button to finish, gather some information and do a small computation. However the button is managed by the wizard component.

Possible Solutions:

  • On each operation mirror the needed state in redux (produces overhead as I don't show the informations and they are duplicate and it might be rather much information)

  • Move the state of the graph up to the wizard component so that on the button press the necessary information can be taken (defeats the whole point that i wanted to split the logic in the Graph component)

Thank you for your help

1 Answers
Related