From 6a80ae4d0091b669dc0de5ac9b4c83f4aac56fa9 Mon Sep 17 00:00:00 2001 From: David Janda Date: Sat, 4 Apr 2020 03:57:21 -0700 Subject: [PATCH 1/3] Replaced getInitialProps with SSG --- examples/with-xstate/pages/index.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/examples/with-xstate/pages/index.js b/examples/with-xstate/pages/index.js index 3e32a3b2cbd13..612ef502d2644 100644 --- a/examples/with-xstate/pages/index.js +++ b/examples/with-xstate/pages/index.js @@ -29,8 +29,12 @@ const IndexPage = ({ count }) => { ) } -IndexPage.getInitialProps = async () => { - return { count: 999 } +export async function getStaticProps() { + return { + props: { + count: 999, + }, + } } export default IndexPage From 7cdb1d54f06185964aaa350b795da60c59216193 Mon Sep 17 00:00:00 2001 From: David Janda Date: Mon, 6 Apr 2020 17:16:24 -0700 Subject: [PATCH 2/3] Removed getStaticProps --- examples/with-xstate/pages/index.js | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/examples/with-xstate/pages/index.js b/examples/with-xstate/pages/index.js index 612ef502d2644..ce37af4c75c60 100644 --- a/examples/with-xstate/pages/index.js +++ b/examples/with-xstate/pages/index.js @@ -4,7 +4,8 @@ import { Counter, Toggle } from '../components' import { toggleMachine } from '../machines/toggleMachine' import { counterMachine } from '../machines/counterMachine' -const IndexPage = ({ count }) => { +const IndexPage = () => { + const count = 999 const [toggleCurrent, toggleSend] = useMachine(toggleMachine) const [counterCurrent, counterSend] = useMachine(counterMachine, { context: { count }, @@ -29,12 +30,4 @@ const IndexPage = ({ count }) => { ) } -export async function getStaticProps() { - return { - props: { - count: 999, - }, - } -} - export default IndexPage From 4d1df2cd0bd09325b253bb1fb971adea33763872 Mon Sep 17 00:00:00 2001 From: Luis Alvarez D Date: Tue, 7 Apr 2020 15:24:42 -0500 Subject: [PATCH 3/3] Apply suggestions from code review Remove count --- examples/with-xstate/pages/index.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/with-xstate/pages/index.js b/examples/with-xstate/pages/index.js index ce37af4c75c60..841c7b6802da5 100644 --- a/examples/with-xstate/pages/index.js +++ b/examples/with-xstate/pages/index.js @@ -5,10 +5,9 @@ import { toggleMachine } from '../machines/toggleMachine' import { counterMachine } from '../machines/counterMachine' const IndexPage = () => { - const count = 999 const [toggleCurrent, toggleSend] = useMachine(toggleMachine) const [counterCurrent, counterSend] = useMachine(counterMachine, { - context: { count }, + context: { count: 999 }, }) return (