diff --git a/examples/with-xstate/README.md b/examples/with-xstate/README.md
new file mode 100644
index 000000000000000..38367fc0ecfcfe1
--- /dev/null
+++ b/examples/with-xstate/README.md
@@ -0,0 +1,46 @@
+# XState example
+
+This example shows how to integrate XState in Next.js. For more info about XState you can visit [here](https://xstate.js.org/).
+
+## Deploy your own
+
+Deploy the example using [ZEIT Now](https://zeit.co/now):
+
+[![Deploy with ZEIT Now](https://zeit.co/button)](https://zeit.co/new/project?template=https://github.com/zeit/next.js/tree/canary/examples/with-xstate)
+
+## How to use
+
+### Using `create-next-app`
+
+Execute [`create-next-app`](https://github.com/zeit/next.js/tree/canary/packages/create-next-app) with [npm](https://docs.npmjs.com/cli/init) or [Yarn](https://yarnpkg.com/lang/en/docs/cli/create/) to bootstrap the example:
+
+```bash
+npm init next-app --example with-xstate with-xstate-app
+# or
+yarn create next-app --example with-xstate with-xstate-app
+```
+
+### Download manually
+
+Download the example:
+
+```bash
+curl https://codeload.github.com/zeit/next.js/tar.gz/canary | tar -xz --strip=2 next.js-canary/examples/with-xstate
+cd with-xstate
+```
+
+Install it and run:
+
+```bash
+npm install
+npm run dev
+# or
+yarn
+yarn dev
+```
+
+Deploy it to the cloud with [now](https://zeit.co/now) ([download](https://zeit.co/download)):
+
+```bash
+now
+```
diff --git a/examples/with-xstate/components/Counter.js b/examples/with-xstate/components/Counter.js
new file mode 100644
index 000000000000000..10e6b440295f18f
--- /dev/null
+++ b/examples/with-xstate/components/Counter.js
@@ -0,0 +1,10 @@
+export default ({ counter = {} }) => (
+
+
+ Count: {counter.count}
+
+
+
+
+
+)
diff --git a/examples/with-xstate/components/Toggle.js b/examples/with-xstate/components/Toggle.js
new file mode 100644
index 000000000000000..ce609b97a110827
--- /dev/null
+++ b/examples/with-xstate/components/Toggle.js
@@ -0,0 +1,14 @@
+import React from 'react'
+
+const Toggle = ({ onToggle, active }) => {
+ return (
+