It’s fucking long time not learning React.
Five Tips
- Displaying Lint Error in the Editor
Create .eslintrc
with content of
1 | { |
- Formatting Code Automatically
1 | npm install --save-dev prettier husky lint-staged |
And add scripts in package.json
1 | { |
I prefer to use prettier
with eslint
- Developing Components in Isolation
…
I use bit
- Making a Progressive Web App
In src/index.js
, change serviceWorker.unregister()
to serviceWorker.register()
- Code Splitting
Create React App v2 supports code splitting via dynamic import()
statements. That is, if it encouters a call to import('./someModule')
when building your app, it will create a new chunk for someModule and all its dependencies, totally seperate from your entry bundle.
1 | import React, { Component } from 'react' |
1 | import React, { Component } from 'react' |