Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'canary' into examples/remove-with-universal-configurati…
Browse files Browse the repository at this point in the history
…on-runtime
kodiakhq[bot] authored Jul 17, 2020

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents 60ffa5a + 5e9f310 commit 1625710
Showing 3 changed files with 25 additions and 38 deletions.
2 changes: 1 addition & 1 deletion examples/with-graphql-faunadb/README.md
Original file line number Diff line number Diff line change
@@ -63,7 +63,7 @@ yarn
yarn dev
```

Make sure to leave us a guestbook message in our [live demo](https://with-graphql-faunadb.now.sh/)! 😉
Your app should be up and running on [http://localhost:3000](http://localhost:3000)!

### Deploy

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { inject, observer } from 'mobx-react'
import React, { useEffect } from 'react'
import { observer } from 'mobx-react-lite'
import Link from 'next/link'
import React from 'react'
import { IStore } from '../store'
import { IStore, useStore } from '../store'
import Clock from './Clock'

interface IOwnProps {
@@ -10,42 +10,27 @@ interface IOwnProps {
linkTo: string
}

@inject('store')
@observer
class SampleComponent extends React.Component<IOwnProps> {
public componentDidMount() {
if (!this.props.store) {
return
}
this.props.store.start()
}
const SampleComponent: React.FC<IOwnProps> = observer((props) => {
const { lastUpdate, light, start, stop } = useStore('')

public componentWillUnmount() {
if (!this.props.store) {
return
useEffect(() => {
start()
return () => {
stop()
}
this.props.store.stop()
}
}, [start, stop])

public render() {
if (!this.props.store) {
return <div>Store not defined</div>
}
return (
<div>
<h1>{this.props.title}</h1>
<Clock
lastUpdate={this.props.store.lastUpdate}
light={this.props.store.light}
/>
<nav>
<Link href={this.props.linkTo}>
<a>Navigate</a>
</Link>
</nav>
</div>
)
}
}
return (
<div>
<h1>{props.title}</h1>
<Clock lastUpdate={lastUpdate} light={light} />
<nav>
<Link href={props.linkTo}>
<a>Navigate</a>
</Link>
</nav>
</div>
)
})

export default SampleComponent
2 changes: 2 additions & 0 deletions examples/with-mobx-state-tree-typescript/package.json
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
"dependencies": {
"mobx": "^5.9.0",
"mobx-react": "^5.4.3",
"mobx-react-lite": "^2.0.7",
"mobx-state-tree": "^3.11.0",
"next": "latest",
"react": "16.13.1",
@@ -17,6 +18,7 @@
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.3.0",
"@types/node": "^14.0.23",
"@types/react": "^16.4.12"
},
"license": "ISC"

0 comments on commit 1625710

Please sign in to comment.