Hello, do you have an example of how to use the useWriteCypher hook?
I had const writeCypher = useWriteCypher(cypher) in a function component, but it would write to the database as soon as the component gets called/mounted. I would like to have a button that would construct cypher (create nodes and relationships) on the fly and write to the database upon clicking on the button. I have also tried binding useWriteCypher(cypher) to a button's onClick event or putting it inside a useEffect function but I would get this error message: React Hook "useWriteCypher" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function
Update: I got it working following the LazyQueries / UseLazyWriteCypher example. Thanks!!
updateMovie({ id: int(0), updates: { title, plot } }) became updateMovie({})(for now)
Hello, do you have an example of how to use the useWriteCypher hook?
I had
const writeCypher = useWriteCypher(cypher)
in a function component, but it would write to the database as soon as the component gets called/mounted. I would like to have a button that would construct cypher (create nodes and relationships) on the fly and write to the database upon clicking on the button. I have also tried bindinguseWriteCypher(cypher)
to a button's onClick event or putting it inside a useEffect function but I would get this error message:React Hook "useWriteCypher" cannot be called inside a callback. React Hooks must be called in a React function component or a custom React Hook function
Update: I got it working following the LazyQueries / UseLazyWriteCypher example. Thanks!!
updateMovie({ id: int(0), updates: { title, plot } })
becameupdateMovie({})
(for now)Thanks in advance! -bmx