Improving coding standards #4
Replies: 0 comments 11 replies
-
Concerning React.FC, there are several explanations for avoiding using it:
You can have a look here: facebook/create-react-app#8177 (there are several other articles that discuss the subject) Maybe it's better to use JSX.Element with typing, what do you think? |
Beta Was this translation helpful? Give feedback.
-
Correct me if I'm wrong, but doesn't DeepReadonly on object --> DeepReadonlyObject, --> DeepReadonly on every If so it's enough to just use export type ComponentProps = DeepReadonly<{
/**
* property description.
*/
property: value
}>
export const Component: React.FC<ComponentProps> = ({property}: ComponentProps): JSX.Element => {/*code here... */} |
Beta Was this translation helpful? Give feedback.
-
How about refactoring the |
Beta Was this translation helpful? Give feedback.
-
It will also be necessary to rework the naming of boolean variables and properties: prefix them with |
Beta Was this translation helpful? Give feedback.
-
This is a discussion to improve coding standards in the repository. We are numerous contributeurs and as a consequence the code we write looks and act differently from one another. This can create smelly code that result in long code review sessions and unnecessary coding mistakes.
To help us we have
ESLint
andPrettier
to format and check problems in our code but tools can only take us so far. To improve our code further we also need to improve our coding output.Following a meeting with @lolottetheclash and @JoeyDjr we have concluded the following items of discussion:
readonly | Readonly<T> | DeepReadonly<T>
. Right now we are using these types differently depending on the author and component. We need some common grounds on what to use and when.Examples
BabylonEngine
,Canvas
andTypography
that passes their props to their children.Example
Examples
useCallback
oruseMemo
, and do we demand thatuseMemo
is used when possible? See #395Example
Examples
Example
Example
Example
Examples
Example
OBS this is from a PR not yet merged-main
always be the first class name of a component? And Should components always hava amain
class name in its first element tag even if the classNames is empty?Examples
Examples
Examples
Beta Was this translation helpful? Give feedback.
All reactions