syntax icon indicating copy to clipboard operation
syntax copied to clipboard

Plan for JSX V4.

Open cristianoc opened this issue 2 years ago • 2 comments

With the introduction of more general structural typing https://forum.rescript-lang.org/t/ann-more-strict-checks-in-missed-labels/2117 most of the JSX ppx could be removed. In particular, one could just use functions from the language directly.

A plan would require

  • [x] Describe precisely how it works. (See https://github.com/rescript-lang/syntax/pull/517/files#diff-c97c31727a92fde7cad7a258699c4d6bf67cba2654d93992c758bf94df5f8411).
  • [x] Evaluate whether it is true that one can just "use the language" to define functions for components. Find out if there are issues and what these are.
  • [x] Figure out a solution to the expressivity problem of @obj records: https://github.com/rescript-lang/syntax/pull/517#issuecomment-1151701199
  • [ ] Check that hover and jump to location in the editor work.
  • [ ] Check that type error messages report the desired location.
  • [ ] Explore JSX preserve mode (i.e. output jsx syntax in the generated code). See https://github.com/rescript-lang/syntax/issues/539.
  • [ ] Explore React's own jsx transform (https://forum.rescript-lang.org/t/jsx-v4-next-rescript-react-0-10-x/3431/10)
  • [ ] Plan a migration path. And what about dependencies.
  • [ ] Engage with the community for feedback. This would be a major visible change. (See forum post)

cristianoc avatar Jun 04 '22 01:06 cristianoc

++ @rickyvetter

cristianoc avatar Jun 04 '22 01:06 cristianoc

Things to consider (that may or may not be solved by simplifying the ppx):

  • Make sure it's easy to comply to the fast-refresh naming rules (capitalized functions, no leading $$) -> also see this forum post

(will probably edit this comment later to add more items)

ryyppy avatar Jun 08 '22 08:06 ryyppy