Deciding which version of React to use in projects for Front End Libraries course

Hello! I just finished the challenges for the Front End Libraries course, and I am ready for the projects. However, it is mentioned that React 18 breaks some of the tests for the projects. I have not seen anybody on this forum ask whether one should progress with the course. Should one be using React 18 and learn while doing the projects, stick to React 17 to pass all of the tests, or is there a better option?

The easiest would be to use React 17 and pass all the tests. Then make a copy of the project and try to upgrade to the latest version and test it. If it now fails, use the old render method to check if that will fix the issue, if not go back to the version that was passing with 17.

The problem is, it can be hard to tell if it is your code or React that is the issue. So to not waste time when debugging, starting with React 17 might be easier.

2 Likes

I noticed that the main difference is that you use the line ReactDOM.createRoot(document.getElementById('root')) to render JSX code instead of ReactDOM.render(). @lasjorg, your answer was my first thought, but what makes me hesitate is that from the view of what will help me learn more, learning the most up to date version of React would be preferable. So, my question now is how much does React 18 change the way I render JSX? Would it take a significant of time to make changes to the way I render JSX if React 18 doesn’t work? Hopefully my question makes sense.

There is not that much difference between the two versions on the user facing API side. It is mainly behind the scenes optimizations (batch rendering). The API additions they did make are for stuff you aren’t likely to use for these challenges, and certainly not anything you need to use. So from a learning perspective, it really doesn’t matter if you are using React 17 or 18.

Tons of codebases are still using older versions, the freeCodeCamp client is still using React 16.

Start with 17, pass all the tests. Then see if you can upgrade and if it is worth the debugging effort. Besides, you don’t really have a choice, the tests have to pass and if using 17 is the only way to make that happen, then that is what must happen.

Trust me, it will not affect your learning. You would need to know and have used React for some time for the changes in 18 to be really meaningful to you.

2 Likes

Thanks for the help! I really appreciate your time @lasjorg!

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.