diff --git a/docs/architecture-decisions/adr006-avoid-react-fc.md b/docs/architecture-decisions/adr006-avoid-react-fc.md index 8b137891791fe..4b28d723613c1 100644 --- a/docs/architecture-decisions/adr006-avoid-react-fc.md +++ b/docs/architecture-decisions/adr006-avoid-react-fc.md @@ -1 +1,28 @@ +# ADR006: Avoid React.FC +## Context + +Facebook has removed ```React.FC``` from their base template for a Typescript project. The reason for this was that it was found to be an unnecessary feature with next to no benefits in combination with a few downsides. + +The main reasons were: +- **children props** were implicitly added +- **Generic Type** lacked support + +## Decision + +To keep our codebase up to date, we have decided that React.FC should be avoided in our codebase when adding new code. + +Here is an example: +```` +type MyType = { text: string } + +// avoid React.FC +const ComponentWithReactFC = React.FC = ({text} =>
{text}
) + +// do this instead +const ComponentWithoutReactFC = ({text} : MyType) =>
{text}
+```` + +## Consequences + +We will gradually remove the current usage of React.FC from our codebase.