Created
January 14, 2021 23:34
-
-
Save kuc-arc-f/3b2a1f1b9286d652116d5469601fd311 to your computer and use it in GitHub Desktop.
Next.js, flash get sample
This file contains 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
// Next.js, flash get sample | |
import flash from 'next-flash'; | |
import Head from 'next/head'; | |
import Link from 'next/link'; | |
import React from 'react' | |
export default class Page extends React.Component { | |
static async getInitialProps (ctx) { | |
return flash.get(ctx) || {} | |
} | |
render () { | |
return ( | |
<div> | |
<Head> | |
<title>Flash messages in Next</title> | |
<meta name='viewport' content='width=device-width, initial-scale=1' /> | |
</Head> | |
{ this.props.name ? <div>FLASH MESSAGE: {this.props.name}</div> : <div /> } | |
<br /> | |
<hr /> | |
</div> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment