Skip to content
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

Support async component for React Server component in JSX v4 #6399

Merged
merged 10 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add tests
  • Loading branch information
mununki committed Oct 1, 2023
commit 2fc6d8f8e30c694673b51a187772242d11f3427c
7 changes: 7 additions & 0 deletions jscomp/syntax/tests/ppx/react/asyncAwait.res
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
let f = a => Js.Promise.resolve(a + a)

@react.component
let make = async (~a) => {
let a = await f(a)
<div> {React.int(a)} </div>
}
12 changes: 12 additions & 0 deletions jscomp/syntax/tests/ppx/react/expected/asyncAwait.res.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
let f = a => Js.Promise.resolve(a + a)
type props<'a> = {a: 'a}

let make = ({a, _}: props<_>) => {
let a = await f(a)
ReactDOM.jsx("div", {children: ?ReactDOM.someElement({React.int(a)})})
}
let make = {
let \"AsyncAwait" = (props: props<_>) => make(props)

\"AsyncAwait"
}