julescynamon / la_Manade

0 stars 0 forks source link

Improve reusability #3

Open demjm opened 1 year ago

demjm commented 1 year ago

In many places you're using hard-coded values, e.g. in the title tag La Manade du Joncas - Actualitées.

To begin with, you can create a file of constants, where you declare strings or values that can be re-used in multiple places. This will help maintain the app as you can edit the local content in a single file, single source of thruth.

Example :

// constants.ts
export const PageTitles = {
  actuality: "La Manade du Joncas - Actualitées",
  contact: "La Manade du Joncas - Contact",
  hebergement: "La Manade du Joncas - Hébergement",
  ...
}

and use the object in a page title tag :

// actuality.js
import {PageTitles} from '../constants';

...

<title>{PageTitles.actuality}</title>

Doing so, it will be very easy in the future to change such values, or inject them in other functions. It is the basics of re-usability that will get you very far, as long as you don't abuse it, by over-abstracting.

julescynamon commented 1 year ago

It's done

demjm commented 1 year ago

Take the habit to link your work when replying for code updates, so the reviewer can simply reach your code.