Boilerplate la gi
Even simple iterators built this way tend to be significantly bulkier than those using generators, with a lot of boilerplate code. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. All previous command and service modules flown (with one exception) were boilerplate versions. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. The boilerplate capsules were designed and used to test spacecraft recovery systems, and escape tower and rocket motors. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. The boilerplate was replaced by concrete in 1990. Từ Wikipedia
Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. Although these licences might be based on a standard boilerplate, each one is thus unique. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. In practice, this is just boilerplate language that comes along with the application. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. The most general kind of form letter consists of one or more regions of boilerplate text interspersed with one or more substitution placeholders. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. Standard form contracts contain boilerplate, which is a set of one size fits all contract provisions. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. She ran the company until 1847, making it into the country's premier manufacturer of boilerplate. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. The term should not be confused with the term boilerplate, which refers to a non-functional spacecraft. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. The boilerplate took the place of actual flight hardware. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. Objects often carry added run-time overhead compared to pure functions, however, and added boilerplate code for defining and instantiating an object and its method(s). Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. The boilerplate capsule was not equipped with a launch escape system. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. In 1877 the brick tower was razed and replaced with a boilerplate iron tower on top of a stairwell in the fort. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. Note that most of the boilerplate in this example exists to provide encapsulation. Từ Wikipedia Ví dụ này từ Wikipedia và có thể được sử dụng lại theo giấy phép của CC BY-SA. Các quan điểm của các ví dụ không thể hiện quan điểm của các biên tập viên Cambridge Dictionary hoặc của Cambridge University Press hay của các nhà cấp phép. Từ ngày 06/12/2011 Tra từ sử dụng VietId đăng nhập. Công cụ cá nhân
Một ngày nào đó bạn ko muốn dùng create-react-app để khởi tạo project nữa, thì đây chính là bài hướng dẫn bạn cần đọc: setup một project từ a tới z mà không dùng create-react-app Tạo thư mục mới nào mkdir react-bolt Vào bên trong thư mục npm init -y Lệnh này sẽ khởi tạo một project npm, trong đó có file Chúng ta tạo thêm một số thư mục cần thiết khác react-bolt |--config |--src |--tests Tiến hành cài đặt npm i --save-dev webpack webpack-cli webpack-dev-server webpack-merge html-webpack-plugin clean-webpack-plugin img-loader url-loader file-loader Bên trong thư mục paths.js import path from 'path'; module.exports = { root: path.resolve(__dirname, '../', '../'), outputPath: path.resolve(__dirname, '../', '../', 'build'), entryPath: path.resolve(__dirname, '../', '../', 'src/index.js'), templatePath: path.resolve(__dirname, '../', '../', 'src/index.html'), imagesFolder: 'images', fontsFolder: 'fonts', cssFolder: 'css', jsFolder: 'js' }; rules.js module.exports = [ { test: /\.js$/, exclude: /node_modules/, use: { loader: 'babel-loader' } }, { test: /\.eot(\?v=\d+\.\d+\.\d+)?$/, exclude: /node_modules/, loader: 'file-loader' }, { test: /\.(woff|woff2)$/, exclude: /node_modules/, loader: 'url-loader?prefix=font/&limit=5000' }, { test: /\.ttf(\?v=\d+\.\d+\.\d+)?$/, exclude: /node_modules/, loader: 'url-loader?limit=10000&mimetype=application/octet-stream' }, { test: /\.(jpe?g|png|gif|svg)$/i, use: ['url-loader?limit=10000', 'img-loader'] } ]; webpack.common.babel.js import webpack from 'webpack'; import HtmlWebpackPlugin from 'html-webpack-plugin'; import paths from './paths'; import rules from './rules'; module.exports = { entry: paths.entryPath, module: { rules }, resolve: { modules: ['src', 'node_modules'], extensions: ['*', '.js', '.scss', '.css'] }, plugins: [ new webpack.ProgressPlugin(), new HtmlWebpackPlugin({ template: paths.templatePath, minify: { collapseInlineTagWhitespace: true, collapseWhitespace: true, preserveLineBreaks: true, minifyURLs: true, removeComments: true, removeAttributeQuotes: true } }) ] }; webpack.dev.babel.js import webpack from 'webpack'; import paths from './paths'; import rules from './rules'; module.exports = { mode: 'development', output: { filename: '[name].js', path: paths.outputPath, chunkFilename: '[name].js' }, module: { rules }, performance: { hints: 'warning', maxAssetSize: 450000, maxEntrypointSize: 8500000, assetFilter: assetFilename => { return ( assetFilename.endsWith('.css') || assetFilename.endsWith('.js') ); } }, optimization: { splitChunks: { chunks: 'all' } }, devServer: { contentBase: paths.outputPath, compress: true, hot: true, historyApiFallback: true }, plugins: [ new webpack.HotModuleReplacementPlugin() ] }; webpack.prod.babel.js import CleanWebpackPlugin from 'clean-webpack-plugin'; import paths from './paths'; import rules from './rules'; module.exports = { mode: 'production', output: { filename: `${paths.jsFolder}/[name].[hash].js`, path: paths.outputPath, chunkFilename: '[name].[chunkhash].js' }, module: { rules }, plugins: [ new CleanWebpackPlugin([paths.outputPath.split('/').pop()], { root: paths.root }) ], devtool: 'source-map' }; Bên trong Tham khảo việc làm React hấp dẫn cho SV Sau cùng, bên trong thư mục gốc, tạo thêm file require('@babel/register'); const webpackMerge = require('webpack-merge'); const common = require('./config/webpack/webpack.common.babel'); const envs = { development: 'dev', production: 'prod' }; /* eslint-disable global-require,import/no-dynamic-require */ const env = envs[process.env.NODE_ENV || 'development']; const envConfig = require(`./config/webpack/webpack.${env}.babel`); module.exports = webpackMerge(common, envConfig); BabelCái các plugin cần thiết cho babel npm install --save-dev @babel/core @babe/cli @babel/node @babel/plugin-proposal-class-properties @babel/plugin-proposal-object-rest-spread @babel/plugin-syntax-dynamic-import @babel/plugin-syntax-import-meta @babel/plugin-transform-async-to-generator @babel/plugin-transform-runtime @babel/preset-env @babel/preset-react @babel/register @babel/runtime babel-eslint babel-jest babel-loader Tạo file { "presets": [ [ "@babel/preset-env", { "useBuiltIns": "entry" } ], "@babel/preset-react" ], "plugins": [ "@babel/plugin-proposal-object-rest-spread", "@babel/plugin-transform-runtime", "@babel/plugin-transform-async-to-generator", "@babel/plugin-proposal-class-properties" ] } EslintCài đặt package npm install --save-dev eslint eslint-config-airbnb eslint-config-prettier eslint-loader eslint-plugin-babel eslint-plugin-import eslint-plugin-jsx-a11y eslint-plugin-prettier eslint-plugin-react Bên trong thư mục gốc, tạo file .eslintrc để cấu hình cho eslint { "parser": "babel-eslint", "extends": ["airbnb", "prettier", "prettier/react"], "plugins": ["prettier"], "parserOptions": { "ecmaVersion": 6, "ecmaFeatures": { "jsx": true } }, "env": { "browser": true, "node": true, "mocha": true, "es6": true, "jest": true }, "rules": { "indent": ["error", 4], "space-before-function-paren": "off", "react/prefer-stateless-function": "warn", "react/jsx-one-expression-per-line": "off", "import/no-extraneous-dependencies": [ "error", { "devDependencies": true } ], "react/jsx-filename-extension": [1, { "extensions": [".js", ".jsx"] }], "linebreak-style": "off", "global-require": "off", "semi": "warn", "arrow-body-style": "off", "no-multiple-empty-lines": ["warn", { "max": 1 }], "no-unused-expressions": [ "error", { "allowTaggedTemplates": true } ], "no-underscore-dangle": [ 2, { "allow": ["__REDUX_DEVTOOLS_EXTENSION__"] } ] } } PrettierCài đặt package npm install --save-dev prettier Tạo file { "printWidth": 80, "tabWidth": 4, "semi": true, "singleQuote": true, "bracketSpacing": true } Cuối cùng chúng ta chỉ còn cài React nữa là xong npm install --save react react-dom cross-env Bên trong thư mục
File import React from 'react'; import ReactDOM from 'react-dom'; import App from './components/App'; ReactDOM.render( Mấy cái router, redux thì bạn cứ xem tài liệu của tụi nó nhé. JestBạn có thể dùng cái khác để test, nhưng Jest thì phổ biến nhất rồi npm install --save-dev jest jest-dom react-testing-library Bổ sung lệnh để chạy test trong "jest": { "setupFiles": [ " config/tests/jest.config.js module.exports = { automock: false, browser: false, bail: false, collectCoverageFrom: [ 'src/**/*.{js,jsx}', '!**/node_modules/**', '!**/vendor/**' ], coverageDirectory: ' config/tests/rtl.setup.js // See https://github.com/kentcdodds/react-testing-library#global-config import 'jest-dom/extend-expect'; import 'react-testing-library/cleanup-after-each'; TopDev via Vuilaptrinh |