Skip to content

Instantly share code, notes, and snippets.

@kuc-arc-f
Created January 14, 2021 23:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kuc-arc-f/3b2a1f1b9286d652116d5469601fd311 to your computer and use it in GitHub Desktop.
Save kuc-arc-f/3b2a1f1b9286d652116d5469601fd311 to your computer and use it in GitHub Desktop.
Next.js, flash get sample
// 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