How do I get rid of inline functions and apply currying

Viewed 32

How do I get rid of inline functions and apply currying ? I get these functions from the container component, which takes them from the ActionCreator redux

render() {
    const {
      isCompleted,
      completeTask,
      id,
      removeTask,
      text,
    } = this.props

    return (
      <Task isCompleted={isCompleted}>
        {text}
        <ButtonContainer>
          <StyledIconUpate
            isCompleted={isCompleted}
            onClick={() => completeTask(id)}
          />
          <StyledIconRemove
            onClick={() => removeTask(id)}
          />
        </ButtonContainer>
      </Task>
    )
  }
}
1 Answers
<ButtonContainer>
          <StyledIconUpate
            isCompleted={isCompleted}
            onClick={completeTask.bind(null, id)}
          />
          <StyledIconRemove
            onClick={removeTask.bind(null, id)}
          />
        </ButtonContainer>
Related