Last active
March 27, 2018 13:31
-
-
Save goodmind/548e7a431eb6d0adba2cb2abf2268303 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@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() | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//@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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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