When I figured I would use Visual Studio Code to get a new React JS application started with learning it etc.. I ran across Microsoft site https://code.visualstudio.com/docs/nodejs/reactjs-tutorial In which this shows to
import registerServiceWorker from './registerServiceWorker';
Meanwhile, there doesn't exist, when I create a new react app it has an index.js file with
import * as serviceWorker from './serviceWorker';
//
serviceWorker.unregister();
registerServiceWorker();
was common but is this completely outdated? What does registerServiceWorker do in React JS? The serviceWorker support is a part of Create React App (the CLI tool, not React itself). Its official docs are a great place for up-to-date information:
switching
serviceWorker.unregister()
toserviceWorker.register()
will opt you in to using the service worker.
As for learning React, while there are a number of great tutorials out there, you can rely on the official tutorial to always reflect the latest version.
React, being just a view library, doesn't prescribe a standard way to make HTTP requests. You can use any popular request library or just plain old Fetch API , and React will play nice with it.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.