P
P
Pantene7422018-07-14 15:11:34
JavaScript
Pantene742, 2018-07-14 15:11:34

What does this line mean in ES6?

Opened the sources of the React Project. this is the variable Action(Redux)
In the first line, "e" is the parameter of the arrow function that we assign to the handleChange constant. Then I don’t understand what is happening ... there are several options, I don’t understand how it works.

export const handleChange = e => dispatch => {    //   <- Эта строка
  dispatch({
    type: PROMO_CODE,
    payload: e.target.value
  });
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Pushkarev, 2018-07-14
@Pantene742

You can just paste https://babeljs.io/repl here and see the result

"use strict";

var handleChange = function handleChange(e) {
  return function (dispatch) {
    dispatch({
      type: PROMO_CODE,
      payload: e.target.value
    });
  };
};

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question