CodeBaseFrontendReactjs
CodeBaseFrontendReactjs copied to clipboard
An open source code base for front-end develop
Code Base Front-end React, Webpack, Babel, Eslint using with Graphql
Setting:
- Connect to Backend
- Setting in 2 file
.env.development.localand.env.production.local
- Setting in 2 file
- Setting router
- Setting in
src/configs/routers/index.js
- Setting in
- Setting Provider
- Setting in
src/utils/provider/index.js
- Setting in
Usage:
- Running with command:
- Start
npm run start
- Build
npm run build
- Catching error from backend
import { DecodeError } from '@utils'
try {
...
} catch (e => {
console.log(DecodeError(e))
})
- Using alias
- Đối với các thư mục cấp 0 từ
src, vui lòng tạo fileindex.jsđểexportcác component ở trong thư mục cấp 0 đó. - Sau khi
exportcác bạn có thểimporttheo cách sau.
- Đối với các thư mục cấp 0 từ
import { ... } from '@components'
import { ... } from '@configs'
import { ... } from '@pages'
import { ... } from '@tools'
import { ... } from '@utils'
- Support Dynamic Import
import('@pages/login').then(({ default: Component }) => {
return <Component />
})
- Support i18next
- Edit file
indexin folderconfig/i18nto translate
- Edit file
- Support eslint
- delete
src/in file.eslintignoreand add script"prestart": "npm run eslint-fix"into filepackage.jsonto use
- delete