Skip to content
This repository has been archived by the owner on Apr 21, 2024. It is now read-only.

Latest commit

 

History

History
51 lines (30 loc) · 1.26 KB

5-TASK.md

File metadata and controls

51 lines (30 loc) · 1.26 KB

💻 Task 5 - Generate a utility lib

⏰  Estimated time: 5-10 minutes

We will move utils to lib.

📚 Learning outcomes:

  • Get familiar with generating project specific, framework agnostic utility libs

🏋️‍♀️ Steps:

  1. Stop the nx serve

  2. Use the @nx/js package to generate another lib in the libs/ folder - let's call it util-formatters.

  3. Add the code for the utility function to the new library you just created libs/store/util-formatters/src/lib/store-util-formatters.ts

  4. Use it in your frontend project to format the rating for each game

    🐳   Hint

    app.tsx:

    import { formatRating } from '@bg-hoard/store/util-formatters';

  5. Serve the store app - notice how the ratings are formatted.

  6. Launch the dependency graph - notice how the app depends on two libs now.

  7. Inspect what changed from the last time you committed, then commit your changes


🎓  If you get stuck, check out the solution


➡️  Next task ➡️