Skip to content

boostcamp-2020/Project18-D-WEB-Boostact

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๊ณต์‹๋ฌธ์„œ

Boostact

WHAT

๋ถ€์ŠคํŠธ์•กํŠธ๋Š” ์ˆœ์ˆ˜ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋งŒ์„ ์‚ฌ์šฉํ•˜์—ฌ ๋งŒ๋“  ์›น ํ”„๋ ˆ์ž„์›Œํฌ์ž…๋‹ˆ๋‹ค.

React ๊ณต์‹ ๋ฌธ์„œ๋ฅผ ํฌํ•จํ•œ ๋งŽ์€ ๊ณณ์— React๋ฅผ ๋‹ค๋ฃจ๋Š” ๋ฒ•์ด ์„ค๋ช…๋˜์–ด ์žˆ์ง€๋งŒ, React์˜ ๋‚ด๋ถ€ ๊ตฌ์กฐ๋ฅผ ์„ค๋ช…ํ•œ ๊ณณ์€ ๋งŽ์ง€ ์•Š์•˜์Šต๋‹ˆ๋‹ค. ๊ทธ๋ž˜์„œ ์ €ํฌ ํŒ€์€ React์˜ ๋‚ด๋ถ€ ๊ตฌ์กฐ์™€ ์›น ํ”„๋ ˆ์ž„์›Œํฌ์— ๋Œ€ํ•œ ๋” ๊นŠ์€ ๊ธฐ์ˆ ์ ์ธ ์ดํ•ด๋ฅผ ์œ„ํ•ด ๋ฆฌ์•กํŠธ ์žฌ์„ค๊ณ„๋ฅผ ๋„์ „ํ–ˆ์Šต๋‹ˆ๋‹ค.

Boostact๋Š” React์— ๋น„ํ•ด ์‚ฌ์ด์ฆˆ๊ฐ€ ์ž‘๊ณ , ์„ฑ๋Šฅ ๋ฉด์—์„œ๋„ ๋” ๋›ฐ์–ด๋‚˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ํ•˜์ง€๋งŒ, ๋ถ„๋ช… React์™€ ๋งค์šฐ ์œ ์‚ฌํ•˜๊ฒŒ ๋™์ž‘ํ•ฉ๋‹ˆ๋‹ค. ์ €ํฌ๋Š” Boostact๊ฐ€ ์ž๋ฐ”์Šคํฌ๋ฆฝํŠธ๋ฅผ ์•„๋Š” ๊ฐœ๋ฐœ์ž๋“ค์ด React๋ฅผ ์ดํ•ดํ•˜๋Š” ๋ฐ์— ํฐ ๋„์›€์ด ๋  ๊ฒƒ์ด๋ผ ์ƒ๊ฐํ•ฉ๋‹ˆ๋‹ˆ๋‹ค. ๋” ๋‚˜์•„๊ฐ€, ์›น ํ”„๋ ˆ์ž„์›Œํฌ ์ „๋ฐ˜์„ ์ดํ•ดํ•˜๋Š” ๋ฐ์—๋„ ๋„์›€์ด ๋  ๊ฒƒ์ž…๋‹ˆ๋‹ค.

์•„๋ž˜์—์„œ๋Š” ์–ด๋–ป๊ฒŒ Boostact๋ฅผ ์‚ฌ์šฉํ•ด๋ณผ ์ˆ˜ ์žˆ๋Š”์ง€ ๊ฐ„๋‹จํ•˜๊ฒŒ ์„ค๋ช…ํ•˜๋ ค๊ณ  ํ•ฉ๋‹ˆ๋‹ค.

์ž์„ธํ•œ ์‚ฌํ•ญ์€ ๋ถ€์ŠคํŠธ์•กํŠธ ๊ณต์‹๋ฌธ์„œ์—์„œ ํ™•์ธํ•ด์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

Getting start

install

Boostact ๋ชจ๋“ˆ์„ ์‚ฌ์šฉํ•˜๊ธฐ ์œ„ํ•ด์„œ๋Š” webpack๊ณผ babel์ด ํ•„์ˆ˜์ ์œผ๋กœ ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋”ฐ๋ผ์„œ ์•„๋ž˜์˜ devDependencies๋ฅผ ๋ชจ๋‘ ์ถ”๊ฐ€ํ•ด์ฃผ์‹œ๊ธฐ ๋ฐ”๋ž๋‹ˆ๋‹ค.

ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ

mkdir projectFolder
npm init -y
npm install boostact

๋ฐ”๋ฒจ ์„ค์น˜

npm install @babel/cli @babel/core @babel/polyfill @babel/preset-env @babel/preset-react --save-dev

์›นํŒฉ ์„ค์น˜

npm install webpack webpack-cli webpack-dev-server --save-dev
npm install html-webpack-plugin mini-css-extract-plugin --save-dev

์ด์ œ package.json์—์„œ webpack ์‹คํ–‰ ๋ช…๋ น์–ด๋ฅผ ๋งŒ๋“ค์–ด์ฃผ์‹œ๋ฉด ๋ฉ๋‹ˆ๋‹ค. ์•„๋ž˜๋Š” .babelrc file๊ณผ webpack.config.js file ์ž…๋‹ˆ๋‹ค.

.babelrc

{
    "presets": ["@babel/preset-env", "@babel/preset-react"]
}

webpack.config.js

const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");

module.exports = {
    mode: "development",
    entry: {
        index: ["@babel/polyfill", "./index.js"],
    },
    output: {
        path: path.join(__dirname, "dist"),
        filename: "bundle.js",
    },
    module: {
        rules: [
            {
                test: /\\.(js|jsx)$/,
                use: "babel-loader",
                exclude: /node_modules/,
            },
        ],
    },
    devServer: {
        host: "127.0.0.1",
        contentBase: path.join(__dirname, "/dist"),
        compress: true,
        hot: true,
        inline: true,
        port: 9000,
        open: true,
    },
    resolve: {
        extensions: [".js", ".jsx"],
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: "index",
            hash: true,
            chunks: ["index"],
            filename: "index.html",
            template: "./index.html",
        }),
    ],
};

index.html

<!DOCTYPE html>
<body>
  <div id="root"></div>
</body>
<script type="module" src="index.jsx"></script>

index.js

import { Boostact } from "boostact";
import App from "./App";
/** @jsx Boostact.createElement */

const root = document.getElementById("root");
Boostact.render(<App />, root);

App.js

import { Boostact } from "boostact";
/** @jsx Boostact.createElement */

const App = () => {
    return (
        <div>
            <h1>Hello!</h1>
            <h2>This is Boostact!</h2>
        </div>
    );
};

export default App;

์—ฌ๊ธฐ๊นŒ์ง€ ์ฝ์œผ์…จ๋‹ค๋ฉด, ์—ฌ๋Ÿฌ๋ถ„๋„ ๋ถ€์ŠคํŠธ์•กํŠธ๋ฅผ ์‚ฌ์šฉํ•˜์‹ค ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฃผ์˜ํ•  ์ ์€ babel์ด jsx๋ฅผ React.createElement๊ฐ€ ์•„๋‹Œ Boostact.createElement๋กœ ํŒŒ์‹ฑ์„ ํ•˜๊ฒŒ๋”, ์•„๋ž˜์˜ jsDoc์„ ์ถ”๊ฐ€ํ•ด์•ผ ํ•œ๋‹ค๋Š” ์ ์ž…๋‹ˆ๋‹ค.

jsdoc (essential)

/** @jsx Boostact.createElement/

contributor

Boostact

Boostact is a web framework created using vanilla JavaScript. There are many descriptions of how to deal with React, including official documents. However, it is difficult to understand the principle of react deeply with simple examples and explanations. To overcome this, we've tried to redesign React. And surprisingly, we created Boostact that works just like React! (Unexpectedly, it includes our own idea. If we cannot follow the action of the actual React, we tried to solve it in a creative way.) Our code is a very small size compared to React, and we cannot say it is excellent in performance at the same time. But rather, that makes it understandable to any developer who knows JavaScript. We will discuss in detail how to use Boostact and how to implement each Hook, a virtual DOM. Please read below.

Getting start

install

To use the Boostact module, webpack and babel are essential. Therefore, please add all of the devDependencies below.

Create project

mkdir projectFolder
npm init -y
npm install boostact

install babel

npm install @babel/cli @babel/core @babel/polyfill @babel/preset-env @babel/preset-react --save-dev

install webpack

npm install webpack webpack-cli webpack-dev-server --save-dev
npm install html-webpack-plugin mini-css-extract-plugin --save-dev

Now you can create a webpack run command in package.json! Below are .babelrc files and webpack.config.js files. You can modify it according to what you want..babelrc

{
    "presets": ["@babel/preset-env", "@babel/preset-react"]
}

webpack.config.js

const HtmlWebpackPlugin = require("html-webpack-plugin");
const path = require("path");
module.exports = {
    mode: "development",
    entry: {
        index: ["@babel/polyfill", "./index.js"],
    },
    output: {
        path: path.join(__dirname, "dist"),
        filename: "bundle.js",
    },
    module: {
        rules: [
            {
                test: /\\.(js|jsx)$/,
                use: "babel-loader",
                exclude: /node_modules/,
            },
        ],
    },
    devServer: {
        host: "127.0.0.1",
        contentBase: path.join(__dirname, "/dist"),
        compress: true,
        hot: true,
        inline: true,
        port: 9000,
        open: true,
    },
    resolve: {
        extensions: [".js", ".jsx"],
    },
    plugins: [
        new HtmlWebpackPlugin({
            title: "index",
            hash: true,
            chunks: ["index"],
            filename: "index.html",
            template: "./index.html",
        }),
    ],
};

index.html

<!DOCTYPE html>
<body>
    <div id="root"></div>
</body>
<script type="module" src="index.jsx"></script>

index.js

import { Boostact } from "boostact";
import App from "./App";
/** @jsx Boostact.createElement */
const root = document.getElementById("root");
Boostact.render(<App />, root);

App.js

import { Boostact } from "boostact";
/** @jsx Boostact.createElement */
const App = () => {
    return (
        <div>
            <h1>Hello!</h1>
            <h2>This is Boostact!</h2>
        </div>
    );
};
export default App;

If you followed up to here, you can use Boostact. Note that jsDoc should be added so that the babel can parse jsx as Boostact.createElement instead of React.createElement.

jsdoc (essential)

/** @jsx Boostact.createElement/

contributor

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •