kuroの覚え書き

96の個人的覚え書き

React JSはじめました。

さっきやっとこさJSONやらAjaxをつかってフロントエンドとバックエンドのやり取りを成功させたところだが、
気を良くしてReactにも手を出してみる。

まずnpmってなんなん?ってとこからですよ。
Node.jsってのをまず入れるんですね。

$ sudo yum install centos-release-scl-rh
$ sudo yum install rh-nodejs10
$ scl enable rh-nodejs10 bash
$ which node
/opt/rh/rh-nodejs10/root/usr/bin/node
$ node --version
v10.21.0
$ node
> console.log('Node is running');
Node is running
undefined
> .help
.break    Sometimes you get stuck, this gets you out
.clear    Alias for .break
.editor   Enter editor mode
.exit     Exit the repl
.help     Print this help message
.load     Load JS from a file into the REPL session
.save     Save all evaluated commands in this REPL session to a file
> .exit
$ which npm
/opt/rh/rh-nodejs10/root/usr/bin/npm
$ npm --version
6.14.4

これでよかろう。

モジュールをインストールしてみる。

$ npm install --save react-calendar-timeline
npm WARN saveError ENOENT: no such file or directory, open '/home/kkuro/database/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/kkuro/database/package.json'
npm WARN react-calendar-timeline@0.27.0 requires a peer of interactjs@^1.3.4 but none is installed. You must install peer dependencies yourself.
npm WARN react-calendar-timeline@0.27.0 requires a peer of moment@* but none is installed. You must install peer dependencies yourself.
npm WARN react-calendar-timeline@0.27.0 requires a peer of prop-types@^15.6.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-calendar-timeline@0.27.0 requires a peer of react@>=16.3 but none is installed. You must install peer dependencies yourself.
npm WARN react-calendar-timeline@0.27.0 requires a peer of react-dom@>=16.3 but none is installed. You must install peer dependencies yourself.
npm WARN create-react-context@0.3.0 requires a peer of prop-types@^15.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN create-react-context@0.3.0 requires a peer of react@^0.14.0 || ^15.0.0 || ^16.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN database No description
npm WARN database No repository field.
npm WARN database No README data
npm WARN database No license field.

react-calendar-timeline
これを使いたいのだよ。
インストールはこれでいいんかいな?WARN出まくっているけど。

とりあえずもうちょっと簡単な例からやってみないとな。