So how can we now actually set our options here in a in a nicer way and avoid a workaround like we're
having it here?
Previously, we needed to abuse programs to get data from our component.
So that changed in our component into navigation options with respect navigation that's no longer needed
in this scenario here.
We have to submit function and we want to pass a different subnet function to our options here.
Now, we did this by setting parents here and setting to submit Perram to our separate handler at the
separate handler.
Was this function here, which would be updated whenever our form status changed, for example?
Well, now we don't need to do this with set parents anymore.
Instead, what we can now do is we can use a new function called.
Said.
Options still on the navigation prop that does not change, but this set options function here is new
and this allows us to set new options dynamically from inside the component.
So what can we do here?
Well, we feed an object into set options and now here we can dynamically adjust our options.
So in this case, I can get rid of this line here where we extract a separate function, our screen
options, and instead go to the place where we use it, which is the header right option.
And now we can grab it.
He had a right configuration here from the screen options and go into the component.
Here where I set the options and set it dear instead, so now I set my header right option here from
Enzyte component and the cool thing is here, I can now refer to that submit handler function and sensitises
and use a fact whenever that handler changes will reset that option.
So if we now save that.
And we reload our application and we go to the admin area.
And then click on ADD here you see this works without an error, and if I try adding my book here again.
Where this price test book?
You see, this now works, I'm getting a key error here, which will have to look into but generally
this works and it work without errors.
Now, what's not working here is my all products page.
I briefly see my product here, but then I get an error again so we can't look into this.
But besides that, this now works and using parents now works and we now don't have to use Perm's for
things that don't really have something to do with parents.
Right.
Parents should only be for transporting data from screen A to B when navigating and not from inside
a screen with set options.
We can now update our options dynamically without abusing parents.