This repository was archived by the owner on Dec 19, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +83
-135
lines changed Expand file tree Collapse file tree 5 files changed +83
-135
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,8 @@ import Child from './child';
77import './bg.css' ;
88import './styles.less' ;
99
10+ const DynamicComponent = React . lazy ( ( ) => import ( './dynamic' ) ) ;
11+
1012class App extends React . Component {
1113 state = {
1214 counter : 0
@@ -45,6 +47,9 @@ class App extends React.Component {
4547 Does it leak SECRET_TOKEN:{ ' ' }
4648 { process . env . SECRET_TOKEN === undefined ? 'No' : 'Yes' }
4749 </ p >
50+ < React . Suspense fallback = { < div > Loading dynamic component...</ div > } >
51+ < DynamicComponent />
52+ </ React . Suspense >
4853 < p > Background image snowflake:</ p >
4954 < div className = "snowflake" style = { { height : 300 , width : 300 } } />
5055 < p > Real image snowflake:</ p >
@@ -53,6 +58,7 @@ class App extends React.Component {
5358 The library < code > p-finally</ code > is not ES5, so this page should
5459 throw an error in older browsers like IE11.
5560 </ p >
61+
5662 </ div >
5763 ) ;
5864 }
Original file line number Diff line number Diff line change 1+ import React from 'react' ;
2+
3+ function Dynamic ( ) {
4+ return (
5+ < div className = "dynamic" > I was loaded dynamically</ div >
6+ )
7+ }
8+
9+ export default Dynamic ;
Original file line number Diff line number Diff line change 44body {
55 color : @light-blue ;
66}
7+ .dynamic {
8+ background : lightseagreen ;
9+ color : #333 ;
10+ border-radius : 6px ;
11+ padding : 6px ;
12+ }
You can’t perform that action at this time.
0 commit comments