Dear team,
When I try to access a variable from within onSubmit, it always returns initial state of the variable
Attached code demonstrate a very simple Gatsby+tina solution
onSubmit method on tina form and onClick method on “Say my name” button call the same method onSubmitImplementation which yells out current value of name
name starts as Jon
and useEffect changes it to snow
When I click on Submit button on tina form I get Jon
, the initial value
When I click on Say my name button, I get Snow
, the latest value
What should I do in order to access current state of an object from onSubmit. Please note the object could be something like security context and may not necessarily be a part of from page-data
Many thanks in advance
Repo https://github.com/chintenemeegamarachchi-dev/tinacms-onsubmit
Code