Last active
July 24, 2024 13:27
-
-
Save naeem-gitonga/73aba165af5455967b5198fb6ca9d7c3 to your computer and use it in GitHub Desktop.
example of lazy-loading and using context-api together pt. 3.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const Form = React.lazy(() => import('./form/form')); | |
class App extends Component { | |
state = { | |
open: false, | |
} | |
handleClick = () => { | |
this.setState({ open: true }); | |
} | |
render() { | |
return ( | |
<Grid | |
container | |
className={styles.App} | |
direction="row" | |
justify="center" | |
alignItems="center" | |
> | |
< Button | |
onClick={ () => this.handleClick() } | |
variant="contained" | |
color="primary" | |
>Click Me</Button> | |
{ | |
this.state.open && ( | |
<Suspense fallback={<CircularProgress />}> | |
<Form/> | |
</Suspense> | |
) | |
} | |
</Grid> | |
); | |
} | |
} | |
export default App; |
Hi, the answer is in the article:
https://naeemgitonga.com/articles/react-context-api.
…On Wed, Jul 24, 2024 at 09:24 Tuan Anh ***@***.***> wrote:
***@***.**** commented on this gist.
------------------------------
Hi, where is the using of context api?
—
Reply to this email directly, view it on GitHub
<https://gist.github.com/JNaeemGitonga/73aba165af5455967b5198fb6ca9d7c3#gistcomment-5131763>
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGLVKEX7H7NF4SG3LYBK3MLZN6TKVBFKMF2HI4TJMJ2XIZLTSKBKK5TBNR2WLJDUOJ2WLJDOMFWWLO3UNBZGKYLEL5YGC4TUNFRWS4DBNZ2F6YLDORUXM2LUPGBKK5TBNR2WLJDHNFZXJJDOMFWWLK3UNBZGKYLEL52HS4DFVRZXKYTKMVRXIX3UPFYGLK2HNFZXIQ3PNVWWK3TUUZ2G64DJMNZZDAVEOR4XAZNEM5UXG5FFOZQWY5LFVA4TGNZUGYZTCMNHORZGSZ3HMVZKMY3SMVQXIZI>
.
You are receiving this email because you authored the thread.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>
.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, where is the using of context api?