Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Conversation

@mununki
Copy link
Member

@mununki mununki commented Oct 25, 2022

This PR adds a new feature for JSX v4 which is using shared props type as an argument of @react.component
#695

Example

type sharedProps<'a> = {x: 'a, y: string} // original module V4C2 = { @react.component(:sharedProps<'a>) // <- here let make = (~x, ~y) => React.string(x ++ y) } // converted to module V4C2 = { type props<'a> = sharedProps<'a> @react.component(: sharedProps<'a>) let make = ({x, y, _}: props<'a>) => React.string(x ++ y) let make = { let \"SharedProps$V4C2" = (props: props<_>) => make(props) \"SharedProps$V4C2" } }
@mununki mununki requested review from cknitt and cristianoc October 25, 2022 16:17
@mununki mununki changed the title Shared props JSX v4 shared props Oct 25, 2022
@cknitt
Copy link
Member

cknitt commented Oct 25, 2022

Great work! Thanks a lot! 🎉

All the tests have sharedProps<'a> with a single type parameter. Maybe also add a test with no type parameter and a test with more than one.

@mununki
Copy link
Member Author

mununki commented Oct 25, 2022

Great work! Thanks a lot! 🎉

All the tests have sharedProps<'a> with a single type parameter. Maybe also add a test with no type parameter and a test with more than one.

Good point. Added e39c867

@mununki mununki merged commit 22776fd into master Oct 25, 2022
@mununki mununki deleted the shared-props branch October 25, 2022 17:35
@mununki
Copy link
Member Author

mununki commented Oct 25, 2022

Sorry, every time I forgot the changelog. I’ll add it on another PR.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

3 participants