1 00:00:00,930 --> 00:00:03,860 As we just saw our blog post form is working really well. 2 00:00:03,870 --> 00:00:08,460 When we show it from the edit screen but not quite so well when we show it from the create screen and 3 00:00:08,460 --> 00:00:11,940 that's entirely because the create screen does not provide this initial values prop. 4 00:00:12,480 --> 00:00:15,440 So in this vacant video we're going to figure out how to solve that. 5 00:00:15,520 --> 00:00:20,490 So to make sure that this initial values prop is not going to cause any issue we're going to go underneath 6 00:00:20,490 --> 00:00:26,130 the definition of our blog post form right underneath my component definition and right above my style's 7 00:00:26,130 --> 00:00:26,890 definition. 8 00:00:27,000 --> 00:00:35,670 I'm going to write out blog post form dot default props and I'll set that equal to an object so this 9 00:00:35,670 --> 00:00:41,170 default prompts property right here can be used to give our component some default property values. 10 00:00:41,370 --> 00:00:46,740 In other words if we ever show this component and we choose not to pass in some given prop this object 11 00:00:46,740 --> 00:00:55,340 right here will be used to fill in some default values inside of here we can put in initial values and 12 00:00:55,340 --> 00:01:04,020 I'll set that to an object that has a title of empty string and content of empty string as well so now 13 00:01:04,020 --> 00:01:09,540 anytime that we show our blog post form inside of our create screen we do not make use of the initial 14 00:01:09,540 --> 00:01:10,270 values prop. 15 00:01:10,290 --> 00:01:16,880 So instead we're going to have an initial value of that object right there so whenever we show blog 16 00:01:16,880 --> 00:01:22,460 post form from the create screen initial values dot title will be an empty string and content will be 17 00:01:22,460 --> 00:01:29,300 an empty string as well so that should solve our issue when the owner mentioned here is that this default 18 00:01:29,300 --> 00:01:34,880 prop system is 100 percent automatic react is going to automatically check to see if our component has 19 00:01:34,880 --> 00:01:41,800 this default props property on it if it does it's just going to automatically use these props for us. 20 00:01:41,990 --> 00:01:46,010 So let's save this file and test this out. 21 00:01:46,100 --> 00:01:52,110 It's a back inside of my emulator I'm going to try editing test post first so I'll edit it in I still 22 00:01:52,110 --> 00:01:58,440 should see the appropriate title in content and if I go back over and try to create a new post I no 23 00:01:58,440 --> 00:02:05,250 longer crash at the screen anymore and I can still enter in a title in content like so very good. 24 00:02:06,090 --> 00:02:07,190 All right so this looks pretty good. 25 00:02:07,200 --> 00:02:11,610 We've now solved that crashing issue and I think that our blog post forum in general is in a pretty 26 00:02:11,610 --> 00:02:12,820 good spot. 27 00:02:12,870 --> 00:02:17,970 It's not the last thing we have to do is make sure that inside of our edit screen here's edit screen 28 00:02:17,970 --> 00:02:18,870 right here. 29 00:02:19,020 --> 00:02:24,450 Once a user submits the changes made to a blog post we need to somehow persist that back inside of our 30 00:02:24,450 --> 00:02:25,920 context object. 31 00:02:25,920 --> 00:02:27,870 So let's take care of that inside the next video.