Skip to content

Commit bdb2a9f

Browse files
committed
Adding readme
1 parent f0c609e commit bdb2a9f

File tree

3 files changed

+33
-2
lines changed

3 files changed

+33
-2
lines changed

ConnectBase.js

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = require('./lib/ConnectBase')

README.md

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# connect
2+
3+
* Connect your react component to your flux store.
4+
* Automatically pass the flux instance to your component.
5+
* Has hooks for shouldComponentUpdate, didMount, willMount, etc.
6+
* Can be extended to create your own connectors.
7+
8+
Example
9+
10+
```js
11+
import connect from 'alt-connect'
12+
import React from 'react'
13+
import UserStore from '../stores/UserStore'
14+
15+
class MyComponent extends React.Component {
16+
render() {
17+
return <div>Hello, {this.props.userName}!</div>
18+
}
19+
}
20+
21+
connect(MyComponent, {
22+
listenTo() {
23+
return [UserStore]
24+
},
25+
26+
getProps() {
27+
return {
28+
userName: UserStore.getUserName(),
29+
}
30+
},
31+
})
32+
```

src/connect.js

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import React from 'react'
22
import ConnectBase from './ConnectBase'
33

4-
export { ConnectBase }
5-
64
export default (Component, config = {}) => {
75
return class extends ConnectBase {
86
static displayName = `Stateful${Component.displayName || Component.name}Container`

0 commit comments

Comments
 (0)