So you can see again we get some inputs and then the contex parameter. And the first thing we do in this case is call session.authorized And this is going to ensure that the user is logged in. If it's not it will throw an error. And that error will propagate all the way to the front end and it will show either a login form if they're not logged in or it will show it on an authorized page if they don't meet the required rule. And of course you can customize that whatever you want. But that's the default setup. So we find the project and if it's not we don't get the project and we throw a not found error and again that propagates to the front end and shows a 404 page.
Alright, so let's use this thing We simply import this function over into your component. And inside this project component the first thing we do is get the parameter from the route. So this is project ideas. A dynamic parameter that you get from the url and then we have a usequery hook that you pass that query function we were just looking at, you pass it to usequery and then the second parameter to that is the argument so where id is equal to the id of this route and then you get that back and you just render it. Now one thing to note here is we have concurrent mode enabled in Blitz by default and so you're using suspense which is really awesome. So you can see in this component we don't have this entire if else dance of if loading show the loading if error show the error, if something else show something whatever. It's just very simple so it's really cool and then in the page component toward the bottom half of the screen you can see we have the suspense component and the fallback for the error and so it's a really nice API. Usequery is built on top of reactquery and reactquery provides a ton of awesome stuff that you get by default in here caching all your server data, caching and validation, polling, all these sorts of things, really powerful features and you just get it by default.
Okay, so how do you get started with Blitz? Well it's pretty hard there's only two commands and first thing is install Blitz globally as a CLI and then secondly is run Blitz new and pass it the name of your app and that's it. And it'll just generate your app for you, install your dependencies and so forth, and then like I mentioned you can immediately sign up and log in as a user and it's awesome.
Alright, let's talk about community over code, so this is one of our foundational principles. People are far more important than anything else and these are principles that we hold dearly in the Blitz community, but it's also principles that we as a tech community at large really embrace and live by. Secondly, we treat every person with dignity and worth regardless of who they are, what their beliefs, they, every person is worthy of dignity and worth. We're all in this together, we all want to be productive, we all want to have fun in our jobs and we're all more similar than we are different, so we can and should solve problems together. We have an entire page in our documentation linked here that details how the Blitz community operates, we'll go through pretty much everything and so you can get a good idea like if you want to be involved in the Blitz community or not, you know, want to see how things operate, that's a good place to do so.
OK, now let's talk about how you can contribute to Blitz. So we need your help, we love all the help we can get, we have a bunch of features in our GitHub that are ready to work on but they're just sitting there waiting for somebody to work on them. I'm working mostly full-time on Blitz and then doing consulting on the side. So far, I'm doing the, I'm contributing by far the most, but we'd love anyone else to help in their free time as much as they can. We appreciate any type of contribution, whether it's code, documentation, improving documentation, tutorials, videos, blog posts, anything you can think of. Secondly, donations and sponsorships, it's my goal to work full-time on Blitz without having to do consulting on the side and then beyond that, I would love to pay other people to work on Blitz too, full-time. I would love any type of donation or sponsorship that you can give us through GitHub. There's a button on our GitHub repo.
Comments