yarn redwood generate page (
yarn rw for short) in this lesson to generate an
The first argument to
yarn rw generate page is the name of the page you are generating. The second argument is the path you want the page to show up on. So
yarn rw generate page index / will generate an
IndexPage component and insert a route entry in our
We learn that redwood import
React for you so you don't have to import it manually when you are creating a component.
Instructor: [0:00] Right now we have a default empty Redwood project. As you can see in our routes, all we have is the not found page.
[0:08] To generate a new page, open up a new terminal and we'll use the Redwood's CLI to generate a new index page. We'll call Yarn Redwood. You can use rw for short, generate page. This tells Redwood to generate a page component. The first argument is the name of the page that we're generating. In this case, index.
[0:35] The next argument is the path we want the page to be on. Since we're generating an index page, we want it to be on our root path.
[0:46] Redwood generated an index page test file and the index page and updated our routes. If we go over to our routes, you can see that Redwood inserted a route with the path that we passed in and the component. You can see that Redwood generated a component called index page. This is a convention where all of the pages are appended with the word page.
[1:18] If we go over to our file, you'll notice that React is not imported. That's because Redwood decided that they will import React for you. If we modify this and we say hello egghead. When we go to our browser, we'll see that we have index page and hello egghead.