I'm rendering RootComponent:
//RENDERING ROOT COMPONENT-------------------------------------------------------------------------------
ReactDOM.render(
<Provider store={store}>
<RootComponent />
</Provider>,
document.getElementById('app'));
//RENDERING ROOT COMPONENT-------------------------------------------------------------------------------
RootComponent has only one container:
//ROOT COMPONENT----------------------------------------------------------------------------------------------------
const RootComponent = () => (
<div>
<BookListContainer />
</div>
);
//ROOT COMPONENT----------------------------------------------------------------------------------------------------
BooklistContainer:
//BOOKLIST CONTAINER-------------------------------------------------------------------------------------------------------
class BookListContainer extends Component{
componentWillMount(){
console.log('componentWillMount executing...');
() => this.props.ajaxRequestTriggeredMethod();
}
render() {
return (
<div>
<BooksList DataInputParam={this.props.books} BtnClickHandler={this.props.buttonClickedMethod} />
</div>
);
}
}
const mapStateToProps = (state) => {
return{
books: state.BooksReducer
};
};
const mapDispatchToProps = (dispatch) => {
return {
buttonClickedMethod: () => dispatch({type: 'BUTTON_CLICKED'}),
ajaxRequestTriggeredMethod: () => console.log('ajaxRequestTriggeredMethod is consoled...')
};
};
connect(mapStateToProps, mapDispatchToProps)(BookListContainer);
//BOOKLIST CONTAINER-------------------------------------------------------------------------------------------------------
All components are in one js file at the moment, so i'm not exporting/importing anything except standard libraries...
Result: i'm getting 'componentWillMount executing...' message in the console, but not getting 'ajaxRequestTriggeredMethod is consoled...' message. Also, no errors in the console are displayed.