Coding guidelines
Parameters
Parameters will be divided into 3 broad categories, parentProps, required parameters and optional parameters.
When creating a class, the constructor will generally have 2 parameters: parentProps and an object called 'params' containing the rest of them. Some classes may not need parentProps, or a params object, or either of them; in those cases they are not added, which means some specific classes may instead have 1 or 0 parameters.
Required parameters will not have default values, they must be provided as arguments every time the class is used.
Optional parameters may have default values, but they may also have no default value. No default value is preferred, and the class will handle the scenario where it is undefined. Some examples of correct default values for optional parameters include:
- The parameter is a constrained list of possible values (ex. size: 'small' | 'medium' | 'large').
- The parameter is of type boolean, in which case false is preferred to undefined.
We will take advantage of type checking to help make sure the classes are being used correctly. By placing the name of the