acdlite / acdlite/react-rx-component
"setState" on componentDidMount
- Ngôn ngữ chính
- JavaScript
- Star
- 83
- Fork
- 4
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
Hi
I'm trying to create a smart component to retrieve window size and pass it as props to the dumb component. It works fine when I resize the window.
I was wondering how i could update width and height on componentDidMount with this approach.
``` javascript
const TestContainer = createRxComponent(props$ => {
const resize$ = Observable
.fromEvent(window, 'resize')
.map( e => ({ width: window.innerWidth, height: window.innerHeight }) )
.startWith({ width: 0, height: 0 })
return Observable.combineLatest(props$, resize$, (props, { width, height }) => ({
...props,
width,
height
}))
}, Test)
function Test(props){
const { width, height } = props
return (
width: {width}
height: {height}
)
}
```
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.