![]() In your terminal or command line, enter the following commands to create a new app using called my-cool-app: npx create-react-app my-cool-appĪfter a few moments, you will see a new React app running in your browser: The Setting Up Your React Dev Environment Easily article goes into more detail how you can use it, but overall it is so simple, there is no harm in repeating it here. Once you have gotten yourself familiar with React, the other popular way to use React as part of your app is via the popular Create React App command tool. If you mix and match versions between them, you might run into some weird issues. Whatever you do, you should ensure that the version number for both React and ReactDOM are the same. For example, here is the path for referencing version 16.7.0: Choose the development.js file equivalent for both React ( ) and ReactDOM ( ). Once you have picked the version, you will typically see a lot of files that you can use. On that page, find the version picker on the top-right corner to see all available versions that you can use: Visit the unpkg CDN page for both react as well as react-dom. To change the version to something else, I don't recommend randomly putting version numbers in the path and seeing whether they return a valid JS file or not. The version of React that is used can easily be inferred by looking at the path. Like we covered in Building Your First React App, the easiest (and preferred) way to get started with React is by referencing the React and ReactDOM libraries directly from a CDN and specifying them in your HTML page like you would any old script: This article will quickly run through how you can jump between versions of React on an existing app really painlessly. If your apps rely on React, you will find yourself at some point needing to update your version of React to something more recent to take advantage of these changes. Cool new features and under-the-hood improvements get added to to React all the time.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |