javascript REACT-JS

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript REACT-JS相关的知识,希望对你有一定的参考价值。

npx create-react-app my-app



Success! Created my-app at C:\Users\Ian\my-app
Inside that directory, you can run several commands:

  npm start
    Starts the development server.

  npm run build
    Bundles the app into static files for production.

  npm test
    Starts the test runner.

  npm run 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 my-app
  npm start
// https://devhints.io/react
 
// use this to create components
// https://www.npmjs.com/package/react-create
npm install -g react-create
 
 
// Create Home component file that mounts to the DOM
$ react-create component Home --entry
// will generate this Home.js file
 
import React, { Component } from 'react';
import ReactDOM from 'react-dom';
 
export default class Home extends Component {
 render() {
    return (
      <div className="home">
        { this.props.children }
      </div>
    )
  }
}
 
ReactDOM.render(<Home/>, document.getElementById('app'));
swap_vert
createApp
// mkdir or clone from github
// https://reactjs.org/docs/getting-started.html
npx create-react-app my-app
cd my-app
npm start
 
create-react-app newAppName
 
//cd into newAppName directory
 
//install libraries for e.g
 
npm install --save axios react-router react-router-dom redux react-redux redux-logger redux-thunk
 
// redux-saga, Redux, and isomorphic-fetch to create, fetch, update, complete, and delete tasks.
 
npm install --save redux-saga, Redux, isomorphic-fetch
///react-router-dom to create a new route to a detailed view of a task:

以上是关于javascript REACT-JS的主要内容,如果未能解决你的问题,请参考以下文章

未找到模块:错误:无法解析 React-js?

Node-SASS 源映射不适用于 React-JS

无法使用 fontawesome 的 react-js 库显示图标

React-js中的环境变量

react-js中如何从组件中取出props数据?

如何使用react-js以动态形式将复选框值与文本输入绑定?