MovieForm Implementation - Getting MovieID from path URL

Hi everyone,

Wondering if anyone has worked through implementing movieForm. I’m stuck attempting to call the new movieID from the URL using const movieId = this.props.match.params.id, as I get the following message:

Uncaught TypeError: Cannot read properties of undefined (reading 'params')

Searching StackOverflow, I found this thread which proposes switching movieForm from class-based to functional component.

I know functional components are standard now (I’ve yet to cover it as I have been attempting to complete Mosh’s course sequentially), so I’m wondering if I need to skip to the Advanced Topics on Functional Components section and learn how to convert it? Or if it’s possible keeping it as a CC? If I did convert it to a functional component, how would I handle the data in the state object? My minimal understanding thinks this would be a job for Redux no? If so, does that mean I have to purchase the Redux course?

Thanks for any insight you might have!

You certainly don’t need Redux for such a simple thing, let it be a class or a function component.

Now onto your actual question. I’d suggest that you use the same version of React Router Dom as used by Mosh.

Moreover, moving to function components in the middle of the course will not help you at all. If you still want to use v6, you can hopefully solve your issues by declaring wrappers like mentioned on this page.

Focus on ReactJS only.

Once you are comfortable with ReactJS, you can start learning Redux.

You can start Advanced Topic to learn how to use functional components as well.

Since the course is outdated, it will be bit challenge for anyone learning ReactJS course now as the libraries used in the course has started consuming latest ReactJS APIs (functional components) and their older version will throw issues that are challenging for developers to fix.