Skip to content

Commit 8baf136

Browse files
Merge pull request cerebral#97 from cerebral/reactConnect
React connect
2 parents 27f7c16 + d14ec68 commit 8baf136

File tree

20 files changed

+366
-267
lines changed

20 files changed

+366
-267
lines changed

.eslintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,4 @@ packages/*/**/dist/
88
**/coverage/
99
**/vendor/
1010
*.d.ts
11+
packages/node_modules/overmind-react/*

package-lock.json

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
"ts-loader": "4.4.2",
9191
"tslib": "1.9.3",
9292
"typescript": "2.9.2",
93-
"typescript-eslint-parser": "^16.0.1",
93+
"typescript-eslint-parser": "^18.0.0",
9494
"url-loader": "1.0.1",
9595
"vue": "2.5.16",
9696
"vue-template-compiler": "2.5.16",

packages/demos/react-todomvc/src/app/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import App from 'overmind-react'
1+
import App from 'overmind'
2+
import createConnect from 'overmind-react'
23
import * as effects from './effects'
34
import * as actions from './actions'
45
import * as state from './state'
@@ -14,6 +15,6 @@ const app = new App(
1415
}
1516
)
1617

17-
export const connect = app.connect
18+
export const connect = createConnect(app)
1819

1920
export default app

packages/demos/react-todomvc/src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
<body>
2626
<div id="app"></div>
27-
<script src="./index.jsx"></script>
27+
<script src="./index.js"></script>
2828
</body>
2929

3030
</html>
File renamed without changes.

packages/demos/react-typescript-todomvc/src/app/index.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import App, { TConnect } from 'overmind-react'
1+
import App from 'overmind'
2+
import createConnect, { TConnect } from 'overmind-react'
23
import * as effects from './effects'
34
import * as actions from './actions'
45
import * as state from './state'
@@ -20,6 +21,6 @@ const app = new App(config, {
2021

2122
export type Connect = TConnect<typeof app>
2223

23-
export const connect = app.connect
24+
export const connect = createConnect(app)
2425

2526
export default app

packages/demos/vue-todomvc/src/app/actions.js

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import * as operations from './operations'
22
import * as mutations from './mutations'
33

44
export const changeNewTodoTitle = (action) =>
5-
action()
6-
.map(operations.getEventValue)
7-
.mutate(mutations.setNewTodoTitle)
5+
action.mutate(mutations.setNewTodoTitle)
86

97
export const addTodo = (action) =>
10-
action()
11-
.do(operations.preventEventDefault)
8+
action
9+
.run(operations.preventEventDefault)
1210
.mutate(mutations.addTodo)
1311
.mutate(mutations.clearNewTodoTitle)
1412

1513
export const toggleCompleted = (action) =>
16-
action().mutate(mutations.toggleCompleted)
14+
action.mutate(mutations.toggleCompleted)

packages/demos/vue-todomvc/src/app/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import App from 'overmind-vue'
1+
import App from 'overmind'
2+
import createConnect from 'overmind-vue'
23
import * as effects from './effects'
34
import * as actions from './actions'
45
import * as state from './state'
@@ -14,6 +15,6 @@ const app = new App(
1415
}
1516
)
1617

17-
export const connect = app.connect
18+
export const connect = createConnect(app)
1819

1920
export default app
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1 @@
1-
export const getEventValue = (_, event) => event.currentTarget.value
2-
31
export const preventEventDefault = (_, event) => event.preventDefault()

0 commit comments

Comments
 (0)