score:6

Accepted answer

The issue is with:

export default withRouter(connect(
  null,
  mapDispatchToProps
))(DifficultySelection)

The syntax for connect is connect(mapStateToProps, mapDispatchToProps)(component)

Putting your call on a single line, it's perhaps easier to see the error:

withRouter(connect(null, mapDispatchToProps))(DifficultySelection)

connect never properly uses DifficultySelection as an arugment, meaning your file is not returning the connected component.

Simply rearrange it as follows:

export default connect(null, mapDispatchToProps)(withRouter(DifficultySelection))

Or, as suggested in the comments, withRouter can be omitted since this component will receive props from Route:

export default connect(null, mapDispatchToProps)(DifficultySelection)

Related Query

More Query from same tag