Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
e67d17ef
Commit
e67d17ef
authored
Nov 13, 2017
by
yuyaohshimo
Committed by
Tim Neutkens
Nov 13, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add kea example (#3262)
parent
d72d3c09
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
118 additions
and
0 deletions
+118
-0
.babelrc
examples/with-kea/.babelrc
+8
-0
README.md
examples/with-kea/README.md
+25
-0
package.json
examples/with-kea/package.json
+24
-0
index.js
examples/with-kea/pages/index.js
+43
-0
store.js
examples/with-kea/store.js
+18
-0
No files found.
examples/with-kea/.babelrc
0 → 100644
View file @
e67d17ef
{
"presets": [
"next/babel"
],
"plugins": [
"transform-decorators-legacy"
]
}
examples/with-kea/README.md
0 → 100644
View file @
e67d17ef
[

](https://deploy.now.sh/?repo=https://github.com/zeit/next.js/tree/master/examples/with-kea)
# kea example
## How to use
Download the example
[
or clone the repo
](
https://github.com/zeit/next.js
)
:
```
bash
curl https://codeload.github.com/zeit/next.js/tar.gz/master |
tar
-xz
--strip
=
2 next.js-master/examples/with-kea
cd
with-kea
```
Install it and run:
```
bash
npm
install
npm run dev
```
Deploy it to the cloud with
[
now
](
https://zeit.co/now
)
(
[download](https://zeit.co/download
)
)
```
bash
now
```
examples/with-kea/package.json
0 → 100644
View file @
e67d17ef
{
"name"
:
"with-kea"
,
"version"
:
"1.0.0"
,
"scripts"
:
{
"dev"
:
"next"
,
"build"
:
"next build"
,
"start"
:
"next start"
},
"dependencies"
:
{
"kea"
:
"^0.27.3"
,
"next"
:
"^4.1.4"
,
"next-redux-wrapper"
:
"^1.3.4"
,
"prop-types"
:
"^15.6.0"
,
"react"
:
"^16.1.0"
,
"react-dom"
:
"^16.1.0"
,
"react-redux"
:
"^5.0.6"
,
"redux"
:
"^3.7.2"
,
"reselect"
:
"^3.0.1"
},
"license"
:
"ISC"
,
"devDependencies"
:
{
"babel-plugin-transform-decorators-legacy"
:
"^1.3.4"
}
}
examples/with-kea/pages/index.js
0 → 100644
View file @
e67d17ef
import
React
from
'react'
import
{
initStore
}
from
'../store'
import
withRedux
from
'next-redux-wrapper'
import
PropTypes
from
'prop-types'
import
{
kea
}
from
'kea'
@
kea
({
path
:
()
=>
[
'kea'
],
actions
:
()
=>
({
increment
:
amount
=>
({
amount
}),
decrement
:
amount
=>
({
amount
})
}),
reducers
:
({
actions
})
=>
({
counter
:
[
0
,
PropTypes
.
number
,
{
[
actions
.
increment
]:
(
state
,
payload
)
=>
state
+
payload
.
amount
,
[
actions
.
decrement
]:
(
state
,
payload
)
=>
state
-
payload
.
amount
}
]
}),
selectors
:
({
selectors
})
=>
({
doubleCounter
:
[
()
=>
[
selectors
.
counter
],
counter
=>
counter
*
2
,
PropTypes
.
number
]
})
})
class
App
extends
React
.
Component
{
render
()
{
return
(
<
div
>
<
p
>
Double
Counter
:
{
this
.
props
.
doubleCounter
}
<
/p
>
<
button
type
=
'button'
onClick
=
{()
=>
this
.
actions
.
increment
(
1
)}
>
Increment
<
/button
>
<
button
type
=
'button'
onClick
=
{()
=>
this
.
actions
.
decrement
(
1
)}
>
Decrement
<
/button
>
<
/div
>
)
}
}
export
default
withRedux
(
initStore
)(
App
)
examples/with-kea/store.js
0 → 100644
View file @
e67d17ef
import
{
keaReducer
}
from
'kea'
import
{
createStore
,
compose
,
combineReducers
}
from
'redux'
const
reducers
=
combineReducers
({
kea
:
keaReducer
(
'kea'
)
})
const
reduxDevTools
=
typeof
window
!==
'undefined'
&&
window
.
__REDUX_DEVTOOLS_EXTENSION__
?
window
.
__REDUX_DEVTOOLS_EXTENSION__
()
:
f
=>
f
export
const
initStore
=
()
=>
{
return
createStore
(
reducers
,
compose
(
reduxDevTools
)
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment