2016-05-25 8 views
0

私はこのデコレータを読み取り、など@withViewPortの使用状況を源泉ました:@withViewPortデコレータはどのようにReactで動作しますか?

import React from 'react'; 
import withViewport from 'react-decorators/withViewport'; 

@withViewport 
class MyComponent { 
    render() { 
    let { width, height } = this.props.viewport; 
    return <div>Viewport: {width + 'x' + height}</div>; 
    } 
} 

React.render(<MyComponent />, document.body); 

どのようにこの作品@withViewPortデコレータに動作しますか?ウィンドウのサイズを変更している間に状態とこれらの状態が変化しますか?

答えて

関連する問題