safsbe / mental-health-app

1 stars 1 forks source link

Provide guidance on functional components #27

Closed achrinza closed 4 weeks ago

achrinza commented 1 month ago

This issue is a breakdown of https://github.com/safsbe/mental-health-app/issues/26

reagent.core/reactify-component function is used to generate class-based react components from reagent components. This allows reagent components to be used in react components (e.g. React Navigation's navigators).

Although (1) Reagent supports flagging reagent components inside other reagent components to be functional with the [:f> mycomponent] syntax and (2) we have a global-override enabled to cause [:> (class based) to be behave as [:f> (functional), reactify-component ignores the global override flag and does not have a clear functional counterpart for reagent-in-react compatibility:

see: https://github.com/reagent-project/reagent/pull/556 see: https://github.com/reagent-project/reagent/issues/548

However, there is a workaround that's somewhat obscured and implied as deprecated:

see: https://github.com/reagent-project/reagent/blob/fd79a2685e53fcfb71fa68091477f92149c7d0f1/doc/ReactFeatures.md#pre-10-workaround

This issue is to track documenting of the:

  1. Considerations when writing functional components
  2. Different ways (functions, hiccup syntax) for interoping functional components (React-Reagent, Reagent-Reagent, etc.)
achrinza commented 4 weeks ago

No longer required due to migration to TypeScript.

see: https://github.com/safsbe/mental-health-app/pull/37