Skip to content

Commit 03d2a45

Browse files
authored
feat: adds lesson_27 homework and lesson 28 pre-work (#630)
Signed-off-by: Anthony D. Mays <[email protected]>
1 parent 4d0cfba commit 03d2a45

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+6923
-1
lines changed

lesson_27/README.md

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,4 +13,28 @@ Please review the following resources before lecture:
1313

1414
## Homework
1515

16-
TODO(anthonydmays): Add necessary details
16+
- [ ] Complete the [Using an API](#using-an-api) assignment.
17+
- [ ] Do pre-work for [lesson 28](/lesson_28/).
18+
19+
### Using an API
20+
This exercise will give you hands-on experience with the React framework and supporting tools to enhance a dynamic front-end application that communicates with a backend API.
21+
22+
#### Starting the servers
23+
24+
1. Copy the React [template](./template/) folder to your own unique folder. Make necessary code changes in your folder only.
25+
2. Install the [API server](./api/) using `npm install` and then run it using the `npm run dev` command.
26+
3. Install the React web server in your copy using `npm install` and then run it using the `npm run dev` command.
27+
28+
#### Updating the ProgramList components
29+
4. Modify the `ProgramList` component so that it calls the API to generate a list of programs using the returned data instead of the fake data. The needed HTML and CSS has already been provided for you.
30+
- You can reference the types/interfaces used in the API by importing from the `@code-differently/types` package.
31+
32+
#### Create a page for adding new programs
33+
4. Create a new page (similar to the Home page component) that allows you to provide a new title and description and then use the API to add it to the existing list of programs.
34+
5. Add a link to the new page in the [Header](./template/src/components/header/Header.tsx) component that navigates to the new page.
35+
36+
> [!NOTE]
37+
> You can use the [React Router tutorial](https://reactrouter.com/en/main/start/tutorial#updating-contacts-with-formdata) to learn how to handle form submissions. You can also use the [React Query guide](https://tanstack.com/query/latest/docs/framework/react/guides/mutations) to learn how leverage mutation to post to an API.
38+
39+
[react-query-link]: https://tanstack.com/query/latest/docs/framework/react/quick-start
40+
[react-router-link]: https://reactrouter.com/en/main/start/tutorial

lesson_27/api/.prettierrc

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"bracketSpacing": false,
3+
"singleQuote": true,
4+
"trailingComma": "es5",
5+
"arrowParens": "avoid",
6+
"importOrder": [
7+
"<THIRD_PARTY_MODULES>",
8+
"interface",
9+
"(?=content|api)",
10+
"context/",
11+
"mock/",
12+
"config",
13+
"utils/",
14+
"hooks/",
15+
"(components/|./index)",
16+
".svg",
17+
"^../(.*)$",
18+
"(?=./styles.module.scss)"
19+
],
20+
"endOfLine": "auto",
21+
"importOrderSeparation": true,
22+
"importOrderSortSpecifiers": true,
23+
"plugins": ["@trivago/prettier-plugin-sort-imports"]
24+
}

0 commit comments

Comments
 (0)