From 7c2b878e7af3006f3fa00dbe9991eb8a5feb38ed Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 19 Oct 2018 09:35:19 -0400 Subject: [PATCH 1/3] React.lazy() --- text/0000-lazy.md | 98 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) create mode 100644 text/0000-lazy.md diff --git a/text/0000-lazy.md b/text/0000-lazy.md new file mode 100644 index 00000000..9541984a --- /dev/null +++ b/text/0000-lazy.md @@ -0,0 +1,98 @@ + +Start Date: 2018-10-19 +- RFC PR: (leave this empty) +- React Issue: (leave this empty) + +# Summary + +`React.lazy` adds first-class support for code splitting components to React. It takes a module object and returns a special component type. + +# Basic example + +```js +import Input from './Input'; // Regular import +const Button = React.lazy(() => import('./Button')); // Dynamic import + +function Dialog() { + // You can mix normal and lazy-loaded components in one tree + return ( +
+ +