reselect icon indicating copy to clipboard operation
reselect copied to clipboard

Closure and connect argument returning function

Open darul75 opened this issue 10 years ago • 7 comments

Hi,

I have followed described pattern on README page and got to change this

https://github.com/reactjs/reselect#containersvisibletodolistjs-3

const VisibleTodoList = connect(
  makeMapStateToProps,
  mapDispatchToProps
)(TodoList)

by

const VisibleTodoList = connect(
  makeMapStateToProps(),
  mapDispatchToProps
)(TodoList)

Any ideas, can it be due to our redux version ?

Thanks,

Julien

darul75 avatar Jun 20 '16 15:06 darul75

I'm afraid the question isn't clear. Can you explain your situation further? What specific problem are you having? What are you trying to do?

markerikson avatar Jun 20 '16 15:06 markerikson

I have just been following home page tutorial with the following code

const makeMapStateToProps = () => {
  const getVisibleTodos = makeGetVisibleTodos()
  const mapStateToProps = (state, props) => {
    return {
      todos: getVisibleTodos(state, props)
    }
  }
  return mapStateToProps
}

And then add it to connect function as a first parameter

connect(makeMapStateToProps, ....

But it was not working so I replaced it by

connect(makeMapStateToProps(), ....

And it worked.

"react-redux": "4.0.6", "reselect": "2.5.1"

darul75 avatar Jun 20 '16 16:06 darul75

Hmm, I'll take a look.

ellbee avatar Jun 20 '16 16:06 ellbee

You need react-redux 4.3 or greater.

ellbee avatar Jun 20 '16 16:06 ellbee

Great, thx again, we had to removed our ^dependencies to match version exactly, and I had this bad effect. We will upgrade to last redux version soon.

darul75 avatar Jun 20 '16 16:06 darul75

@darul75 Which error did you get when it "wasn't working"?

designbyadrian avatar Feb 13 '17 20:02 designbyadrian

Hi sorry I can not remember as it was a long time ago.

darul75 avatar Feb 13 '17 20:02 darul75