We will move utils to lib.
- Get familiar with generating project specific, framework agnostic utility libs
-
Stop the
nx serve
-
Use the
@nx/js
package to generate another lib in thelibs/
folder - let's call itutil-formatters
. -
Add the code for the utility function to the new library you just created
libs/store/util-formatters/src/lib/store-util-formatters.ts
-
Use it in your frontend project to format the rating for each game
🐳 Hint
app.tsx
:import { formatRating } from '@bg-hoard/store/util-formatters';
-
Serve the store app - notice how the ratings are formatted.
-
Launch the dependency graph - notice how the app depends on two libs now.
-
Inspect what changed from the last time you committed, then commit your changes
🎓 If you get stuck, check out the solution