Skip to content

Provide an onChange api when some properties from inputed data changes #404

@antoninklopp

Description

@antoninklopp

Is your feature request related to a problem? Please describe.
This feature request will allow better connections between the graph and the user interactions.

Describe the solution you'd like
Provide an onChange method when a property involving data is changed, like changing an x or y coordinate by dragging a node. This is the only case that I can think of now but there could be more in the future.

An example could be the following

function App(){

  const [data, setData] = useState(myInitialData); 

  return (
    <Graph 
       id="my-graph"
       data={data}
       onChange={(data) => setData(data)}
  )
}

Describe your use case
If I want to save the state of my graph with the layout changed by a user.

Describe alternatives you've considered
I currently need to keep a reference over the graph and access it by ref.current.state.nodes which is not really the "react way" of doing things.

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationadd documentation to the repository or the the code basefeature request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions