LoginSignup
0
0

More than 5 years have passed since last update.

React 始めました

Posted at

はじめに

nodeのバージョン管理のために、微妙に開発環境はdockerにしてみる...(必要は無いかw

docker-compose.yml
version: "3"
services:
  react:
    container_name: react
    image: node:8.13-alpine
    working_dir: /src
    volumes:
      - ./src:/src
    ports:
      - 3000:3000

create-react-appで雛形の作成

開発環境のrootとなるディレクトリを作成し、create-react-appをローカルにインストールする

$ mkdir src
$ docker-compose run --rm react yarn add create-react-app

sampleアプリを作成してみる

$ docker-compose run --rm react npx create-react-app sample

(中略)

Success! Created sample at /src/sample
Inside that directory, you can run several commands:

  yarn start
    Starts the development server.

  yarn build
    Bundles the app into static files for production.

  yarn test
    Starts the test runner.

  yarn eject
    Removes this tool and copies build dependencies, configuration files
    and scripts into the app directory. If you do this, you can’t go back!

We suggest that you begin by typing:

  cd sample
  yarn start

Happy hacking

デバッグ用のサーバーを起動する

$ docker-compose run --service-ports --workdir="/src/sample" --detach react yarn start

出たw
react.png

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0