DEV Community

Discussion on: Code Review

Collapse
 
naismith profile image
Chris Naismith

Hi Binod,

Some things I noticed just from looking at the code. For one, I would maybe make a suggestion to look at @redux/toolkit. It comes prebundled with redux-thunk, and may be easier for future projects to integrate redux into an application with less boilerplate.

Secondly your mapDispatchToProps in your container I think could be simplified to just an object like so:

const mapDispatchToProps = {
    getAllMovie,
    getSingleMovieDetail
}

Additionally from my experience separating out your page components, from your other components I also find easier to manage as a project grows. An example of something like this would be how Next does their folder structure.

If there's anything specific you want looked at LMK.

Collapse
 
pantbinod001 profile image
Binod Pant

Hi Chris,

Thank you for review my code and give me feedback. In the case of mapDispatchToProps I have used a typescript so I apply a strict type checking.

I had tried this const mapDispatchToProps = {
getAllMovie,
getSingleMovieDetail
} This also works.

Collapse
 
naismith profile image
Chris Naismith

I also use Typescript at work and use this method for mapDispatchToProps. Currently I'm using the @redux/toolkit which exports ActionCreatorWithPayload which is helpful for just reducing complexity. Best of luck.

Thread Thread
 
pantbinod001 profile image
Binod Pant

Thank you, Your suggestion reduces complexity. for the next project, I will apply @redux/toolkit. Once again thank you.