Changeset 3769 for sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/page/index.jsx
- Timestamp:
- 08/03/2016 06:16:09 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/js/client/components/page/index.jsx
r3734 r3769 1 import React , { Component }from 'react';1 import React from 'react'; 2 2 import { connect } from 'react-redux'; 3 3 import find from 'lodash/find'; … … 9 9 import { getPage } from 'actions'; 10 10 11 c lass PageContainer extends Component{11 const PageContainer = React.createClass( { 12 12 componentDidMount() { 13 13 this.getPage(); 14 } 14 }, 15 15 16 16 componentDidUpdate( previousProps ) { 17 if ( this.props.route. name !== previousProps.route.name) {17 if ( this.props.route.path !== previousProps.route.path ) { 18 18 this.getPage(); 19 19 } 20 } 20 }, 21 21 22 22 getPage() { 23 this.props.dispatch( getPage( this.props.route. name) );24 } 23 this.props.dispatch( getPage( this.props.route.path ) ); 24 }, 25 25 26 26 render() { 27 27 return <Page { ...this.props } />; 28 28 } 29 } 29 } ); 30 30 31 31 const mapStateToProps = ( state, ownProps ) => ( { 32 page: find( state.pages, { slug: ownProps.route. name} )32 page: find( state.pages, { slug: ownProps.route.path } ) 33 33 } ); 34 34
Note: See TracChangeset
for help on using the changeset viewer.