Skip to content

Commit c42ad42

Browse files
committed
Add React.lazy
1 parent f8964f2 commit c42ad42

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

src/React.bs.js

+12-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/React.res

+7
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,13 @@ module Experimental = {
143143
}
144144
}
145145

146+
type dynamicallyImportedModule<'a> = {default: component<'a>}
147+
148+
@module("react")
149+
external lazy_: (unit => promise<dynamicallyImportedModule<'a>>) => component<'a> = "lazy"
150+
151+
let lazy_ = load => lazy_(async () => {default: await load()})
152+
146153
/* HOOKS */
147154

148155
/*

0 commit comments

Comments
 (0)