1
0
Fork 0
mirror of https://github.com/terribleplan/next.js.git synced 2024-01-19 02:48:18 +00:00

Fix linting errors (#1235)

This commit is contained in:
Tim Neutkens 2017-02-21 21:52:44 +01:00 committed by GitHub
parent 7d4d709587
commit 9ba7a10f85
8 changed files with 15 additions and 19 deletions

View file

@ -4,7 +4,7 @@ let storeMemoized = null
const getStore = (initialState) => { const getStore = (initialState) => {
let store = null let store = null
if (typeof window == 'undefined') { if (typeof window === 'undefined') {
store = createStore(initialState) store = createStore(initialState)
} else { } else {
if (!storeMemoized) { if (!storeMemoized) {

View file

@ -1,5 +1,4 @@
import { Provider} from 'refnux' import {Provider} from 'refnux'
import getStore from './getStore' import getStore from './getStore'
// The `withRefnux` "decorator" // The `withRefnux` "decorator"
@ -9,7 +8,6 @@ import getStore from './getStore'
// - passes `store` to Component's `getInitialProps` so that it can dispatch actions // - passes `store` to Component's `getInitialProps` so that it can dispatch actions
const withRefnux = (getInitialState, Component) => { const withRefnux = (getInitialState, Component) => {
const Wrapper = (props) => { const Wrapper = (props) => {
var store = props.store var store = props.store
// if getInitialProps was executed on the server we get a store // if getInitialProps was executed on the server we get a store
@ -38,5 +36,4 @@ const withRefnux = (getInitialState, Component) => {
return Wrapper return Wrapper
} }
export default withRefnux export default withRefnux

View file

@ -14,7 +14,7 @@ const Page1 = connect(
<h3>{state.title}</h3> <h3>{state.title}</h3>
<p>Current state: {JSON.stringify(state, null, 2)}</p> <p>Current state: {JSON.stringify(state, null, 2)}</p>
<button onClick={() => dispatch(counterIncrement)} >Increment</button> <button onClick={() => dispatch(counterIncrement)} >Increment</button>
<Link href="/page2"><button>go to page 2</button></Link> <Link href='/page2'><button>go to page 2</button></Link>
</div> </div>
) )

View file

@ -14,7 +14,7 @@ const Page2 = connect(
<h3>{state.title}</h3> <h3>{state.title}</h3>
<p>Current state: {JSON.stringify(state, null, 2)}</p> <p>Current state: {JSON.stringify(state, null, 2)}</p>
<button onClick={() => dispatch(counterIncrement)} >Increment</button> <button onClick={() => dispatch(counterIncrement)} >Increment</button>
<Link href="/page1"><button>go to page 2</button></Link> <Link href='/page1'><button>go to page 2</button></Link>
</div> </div>
) )
@ -24,5 +24,4 @@ Page2.getInitialProps = async function (context) {
return {} return {}
} }
export default withRefnux(getInitialState, Page2) export default withRefnux(getInitialState, Page2)

View file

@ -4,7 +4,7 @@ const storeInitialState = { counter: 0, key: 'value' }
const getStore = () => { const getStore = () => {
let store = null let store = null
if (typeof window == 'undefined') { if (typeof window === 'undefined') {
store = createStore(storeInitialState) store = createStore(storeInitialState)
} else { } else {
store = window.store || createStore(storeInitialState) store = window.store || createStore(storeInitialState)