Skip to content

Instantly share code, notes, and snippets.

@goodmind
Last active March 27, 2018 13:31
Show Gist options
  • Save goodmind/548e7a431eb6d0adba2cb2abf2268303 to your computer and use it in GitHub Desktop.
Save goodmind/548e7a431eb6d0adba2cb2abf2268303 to your computer and use it in GitHub Desktop.
//@flow
import {rootDomain} from 'effector'
import type {OrderedSet} from 'immutable'
const domain = rootDomain.domain('user list')
type User = {
username: string
}
export const user: OrderedSet<User> = domain.OrderedSet()
//@flow
import {user} from './action'
class AddUser extends React.Component<{
addUser: typeof user.add
}, {username: string}> {
render() {
const {username, addUser} = this.props
return (
<form>
<input value={username} />
<button onClick={() => this.addUser({username})}>Submit</button>
</form>
)
}
}
export default connect(null, {addUser: user.add})(AddUser)
import {user} from './action'
const reducer = user
.reducer
.reset(logoutUser)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment