1 00:00:02,190 --> 00:00:10,230 So how can we now actually set our options here in a in a nicer way and avoid a workaround like we're 2 00:00:10,230 --> 00:00:11,030 having it here? 3 00:00:11,700 --> 00:00:17,000 Previously, we needed to abuse programs to get data from our component. 4 00:00:17,010 --> 00:00:23,490 So that changed in our component into navigation options with respect navigation that's no longer needed 5 00:00:23,700 --> 00:00:24,780 in this scenario here. 6 00:00:24,780 --> 00:00:30,580 We have to submit function and we want to pass a different subnet function to our options here. 7 00:00:31,080 --> 00:00:36,150 Now, we did this by setting parents here and setting to submit Perram to our separate handler at the 8 00:00:36,150 --> 00:00:36,990 separate handler. 9 00:00:37,200 --> 00:00:42,940 Was this function here, which would be updated whenever our form status changed, for example? 10 00:00:43,650 --> 00:00:46,390 Well, now we don't need to do this with set parents anymore. 11 00:00:46,710 --> 00:00:50,580 Instead, what we can now do is we can use a new function called. 12 00:00:51,490 --> 00:00:52,120 Said. 13 00:00:52,960 --> 00:00:59,200 Options still on the navigation prop that does not change, but this set options function here is new 14 00:00:59,440 --> 00:01:04,720 and this allows us to set new options dynamically from inside the component. 15 00:01:05,560 --> 00:01:06,650 So what can we do here? 16 00:01:07,120 --> 00:01:12,800 Well, we feed an object into set options and now here we can dynamically adjust our options. 17 00:01:12,850 --> 00:01:18,880 So in this case, I can get rid of this line here where we extract a separate function, our screen 18 00:01:18,880 --> 00:01:23,710 options, and instead go to the place where we use it, which is the header right option. 19 00:01:24,340 --> 00:01:27,130 And now we can grab it. 20 00:01:27,130 --> 00:01:33,040 He had a right configuration here from the screen options and go into the component. 21 00:01:35,050 --> 00:01:40,660 Here where I set the options and set it dear instead, so now I set my header right option here from 22 00:01:40,660 --> 00:01:48,520 Enzyte component and the cool thing is here, I can now refer to that submit handler function and sensitises 23 00:01:48,520 --> 00:01:52,900 and use a fact whenever that handler changes will reset that option. 24 00:01:53,260 --> 00:01:54,640 So if we now save that. 25 00:01:57,900 --> 00:02:02,360 And we reload our application and we go to the admin area. 26 00:02:03,860 --> 00:02:11,120 And then click on ADD here you see this works without an error, and if I try adding my book here again. 27 00:02:12,230 --> 00:02:14,840 Where this price test book? 28 00:02:19,850 --> 00:02:25,220 You see, this now works, I'm getting a key error here, which will have to look into but generally 29 00:02:25,220 --> 00:02:27,920 this works and it work without errors. 30 00:02:28,070 --> 00:02:31,840 Now, what's not working here is my all products page. 31 00:02:32,060 --> 00:02:36,230 I briefly see my product here, but then I get an error again so we can't look into this. 32 00:02:36,500 --> 00:02:43,580 But besides that, this now works and using parents now works and we now don't have to use Perm's for 33 00:02:43,580 --> 00:02:46,910 things that don't really have something to do with parents. 34 00:02:46,920 --> 00:02:47,140 Right. 35 00:02:47,150 --> 00:02:53,870 Parents should only be for transporting data from screen A to B when navigating and not from inside 36 00:02:53,870 --> 00:02:55,650 a screen with set options. 37 00:02:55,670 --> 00:03:00,290 We can now update our options dynamically without abusing parents.