import React, {Component} from "react";
import {connect} from "react-redux";
import {bindActionCreators} from "redux";
/* ваш компонент */
class MyComponent extends Component {
render() {
console.log(this.props);
return (<div></div>);
}
}
const mapStateToProps = (state) => {
return {
state
}
};
const mapDispatchesToProps = (dispatch) => {
return {
dispatch,
// это мы подключаем собственные actions
actions: bindActionCreators(actions, dispatch),
}
};
export default connect(mapStateToProps, mapDispatchesToProps)(MyComponent);
At Facebook, we use React in thousands of components, and we haven't found any use cases where we would recommend creating component inheritance hierarchies.
this.props.children
компонента MainContainer, его рендер должен возвращать что-то вроде этого:<div>
<Header />
<Menu />
<div className="content">
{this.props.children}
</div>
<Footer />
</div>
<MainContainer>
{/* Контент */}
</MainContainer>
// вызов
obj.foo();
// и вызов
const bar = obj.foo;
bar();
// оба вызывают foo, но во втором случае this внутри foo будет привязан не к obj,
// а к глобальному объекту
Почему именно так? Есть какие-то условия?
Выходит что разработчик указывает, что Content Provider должен возвращать MIME-тип "vnd.android.cursor.item/что-то там"?Да именно так.
fb.initCore().then(
() => {
dispatch({
type: FB_LOADED_SUCCESS,
});
dispatch(getUserStatus());
},
() => {
dispatch({
type: FB_LOADED_FAIL,
});
},
);