And then if the navigation state is not handle, I open my overlay. It means that my form is searching. And if not, I close the overlay. And then when the navigation state is loading, I also close my model. Okay, so let's see how it works in the website. So here I have a slow 3G. Okay? And now I go to the console. And I open, so you see navigation state. I type remix. I enter, okay, and I see that it's loading. Okay, so we have an error here, so I think I have made a mistake with my action. Anyway, what I wanted to show you, it's also a bug because I was over complicating things and I was feeling something was not right. And a few weeks ago, I was giving this talk at React Rally in Salt Lake City, and I crossed Ryan Florence, the creator of Remix, and he told me what I was doing wrong. So now, I'm going to show you all the right code, and I wanted to show you that because of our React instinct, we are over complicating things. Okay, so let's go to the right branch. Okay, I have some changes. Okay, so I've made a new form. Okay, so here we have the form done the right way. You know, if oh, yes, I forgot the S at search results. That's why it was bugging. Okay, so action search results, and we have no method or anything, just that, and here I just need my use navigation, and I initiate it here, and then I create a searching variable, so it's a navigation set, and navigation location path name is search result. It means my form is searching. So I create a user effect, and so if yes, if it's searching here, I show my overlay, and then in user effect, if it's not searching, I also close my model window with the search. So what I want to show you is we have to unlearn all the things that we want to put the state everywhere because of this react instinct, and we don't need it, because we are using web standards and this use navigation is already doing everything. Okay, so now we are on the search result page, and we are going to go back to the slides. We need to extract the query from the URL. So let's go back to my slides, okay.
Okay, so to extract the query from the URL, we need to extract the query from the URL, and then to filter the story, for that we will use the Storyblock content delivery API, which is the REST API from Storyblock. So to extract the query, we use the URL constructor to create an object representing the URL defined by the constructors. Then this object includes a search property, which provides utility methods to work with the query string of the URL.
Comments