-
Notifications
You must be signed in to change notification settings - Fork 43
Jsx adaptions #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
@@warning("-27") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where is this coming from? I don't think the ppx adds -27 so I'm surprised to see it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added the -27 attribute manually though |
||
|
||
module Test = { | ||
@bs.obj external makeProps: (~children: 'children, unit) => {"children": 'children} = "" | ||
let make = | ||
(@warning("-16") ~children) => { | ||
children | ||
} | ||
let make = { | ||
let \"Foo$Test" = (\"Props": {"children": 'children}) => make(~children=\"Props"["children"]) | ||
\"Foo$Test" | ||
} | ||
} | ||
|
||
module App = { | ||
@bs.obj external makeProps: unit => {.} = "" | ||
|
||
let make = () => { | ||
(@warning("-3") React.jsx)( | ||
Test.make, | ||
{ | ||
Test.makeProps(~children={React.string("help")}, ()) | ||
}, | ||
) | ||
} | ||
let make = { | ||
let \"Foo$App" = (\"Props": {.}) => make() | ||
\"Foo$App" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
@@warning("-27") | ||
|
||
module Test = { | ||
@bs.obj external makeProps: (~children: 'children, unit) => {"children": 'children} = "" | ||
let make = | ||
(@warning("-16") ~children) => { | ||
children | ||
} | ||
let make = { | ||
let \"Foo$Test" = (\"Props": {"children": 'children}) => make(~children=\"Props"["children"]) | ||
\"Foo$Test" | ||
} | ||
} | ||
|
||
module App = { | ||
@bs.obj external makeProps: unit => {.} = "" | ||
|
||
let make = () => { | ||
@warning("-3") | ||
React.jsxs( | ||
React.Fragment.make, | ||
React.Fragment.makeProps( | ||
~children=React.array([ | ||
(@warning("-3") React.jsx)( | ||
Test.make, | ||
Test.makeProps(~children={React.string("help")}, ()), | ||
), | ||
(@warning("-3") React.jsxKeyed)( | ||
Test.make, | ||
Test.makeProps(~children={React.string("help")}, ()), | ||
"test", | ||
), | ||
]), | ||
(), | ||
), | ||
) | ||
} | ||
let make = { | ||
let \"Foo$App" = (\"Props": {.}) => make() | ||
\"Foo$App" | ||
} | ||
} | ||
|
||
let element = <App/> | ||
|
||
|
||
ReactDOMServer.renderToString(element)->Js.log | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we still want the
@deprecated
here. We want people to use JSX syntax or createElement. If we need to create a directly usable api we can do that outside of this work.