java implements the Virginia Canada algorithm, and the accurate key can be calculated in explicitly

2023-03-14   ES  

React, you need to use the function in the form of a function in the form of the function.
Examples are as follows:

<divlick = {() => {handlechangepage (page, totalPage)}}> change a batch </div>

Note that you cannot write c nclick directly = handlechangepage (page, totalPage), write in the new function

onClick={() => { handleChangePage(page, totalPage) 

Action part corresponding code

const mapDispatchToProps = (dispatch) => {
      return {
        handleChangePage(page, totalPage) {
          if (page < totalPage) {
            dispatch(actionCreators.changePage(page + 1));
          } else {
            dispatch(actionCreators.changePage(1));
          }
        }
      }
    }

actionCreators

export const changePage = (page) => ({
  type: constants.CHANGE_PAGE,
  page
});

reducer

export default (state = defaultState, action) => {
  switch (action.type) {
  ...
    case constants.CHANGE_PAGE:
      return state.set('page', action.page);
    default:
      return state;
  }
}

source

Related Posts

vue2.0 template Handsome

21-CSS

1 feature extract Ghost

CAMUNDA and Spring Boot Integration (3)-Camunda Engine Properties DEMI

java implements the Virginia Canada algorithm, and the accurate key can be calculated in explicitly

Random Posts

About Form Form acquisition value and setting worthy method

linux terminal cannot display emoji problems

SQLDIAG-Configuration File-Extension

Machine Learning Basics

2 line code completion level pull -up list box