From 1948f9e767c5c8f7cb52337ce777a61b5ad1a599 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Sat, 22 Apr 2017 03:05:35 +0900 Subject: Remove deprecated features at React v15.5 (#1905) * Remove deprecated features at React v15.5 - [x] React.PropTypes - [x] react-addons-pure-render-mixin - [x] react-addons-test-utils * Uncommented out & Add browserify_rails options * re-add react-addons-shallow * Fix syntax error from resolve conflicts * follow up 59a77923b368d48c590cd9f4a0c6b73ce972d33f --- .../components/features/favourites/index.jsx | 24 ++++++++++------------ 1 file changed, 11 insertions(+), 13 deletions(-) (limited to 'app/assets/javascripts/components/features/favourites') diff --git a/app/assets/javascripts/components/features/favourites/index.jsx b/app/assets/javascripts/components/features/favourites/index.jsx index 994803175..bd6cf8a90 100644 --- a/app/assets/javascripts/components/features/favourites/index.jsx +++ b/app/assets/javascripts/components/features/favourites/index.jsx @@ -1,5 +1,5 @@ import { connect } from 'react-redux'; -import PureRenderMixin from 'react-addons-pure-render-mixin'; +import PropTypes from 'prop-types'; import ImmutablePropTypes from 'react-immutable-proptypes'; import LoadingIndicator from '../../components/loading_indicator'; import { fetchFavourites } from '../../actions/interactions'; @@ -12,25 +12,17 @@ const mapStateToProps = (state, props) => ({ accountIds: state.getIn(['user_lists', 'favourited_by', Number(props.params.statusId)]) }); -const Favourites = React.createClass({ - - propTypes: { - params: React.PropTypes.object.isRequired, - dispatch: React.PropTypes.func.isRequired, - accountIds: ImmutablePropTypes.list - }, - - mixins: [PureRenderMixin], +class Favourites extends React.PureComponent { componentWillMount () { this.props.dispatch(fetchFavourites(Number(this.props.params.statusId))); - }, + } componentWillReceiveProps(nextProps) { if (nextProps.params.statusId !== this.props.params.statusId && nextProps.params.statusId) { this.props.dispatch(fetchFavourites(Number(nextProps.params.statusId))); } - }, + } render () { const { accountIds } = this.props; @@ -56,6 +48,12 @@ const Favourites = React.createClass({ ); } -}); +} + +Favourites.propTypes = { + params: PropTypes.object.isRequired, + dispatch: PropTypes.func.isRequired, + accountIds: ImmutablePropTypes.list +}; export default connect(mapStateToProps)(Favourites); -- cgit