Tag: reactjs

从React中的Material UI开始的步骤

我正尝试在React中使用material-ui,但是我不知道如何让它工作。 我遵循了文档,并做了如下: npm安装材料 – 用户界面 npm安装 然后在我的App.js中插入“从react-tap-event-plugin”导入injectTapEventPlugin; 然后“从”material-ui / RaisedButton“导入RaisedButton; 我的App.js像这样RaisedButton <RaisedButton label="Default" /> 但是当我运行它时,什么也没有显示在浏览器中。 import React from 'react' require('../../scss/style.scss'); import Userlist from "../Containers/user-list" import UserDetail from '../Containers/user-detail' import injectTapEventPlugin from 'react-tap-event-plugin'; import RaisedButton from 'material-ui/RaisedButton'; const App =() =>( <div> <RaisedButton label="Default" /> <h2> Username list </h2> <Userlist/> <hr/> <h2> User Detail </h2> <hr/> […]

为什么我必须再次运行“webpack”命令?

我正在使用一个React项目。 每次在任何.js文件中做任何修改,我都必须在terminal上再次运行“webpack”命令,才能使浏览器反映出来。 有什么办法可以让我不必再次运行“webpack”命令。 webpack.config.js var path = require('path'); var webpack = require('webpack'); module.exports = { devServer: { inline: true, contentBase: './src', port: 3000 }, devtool: 'cheap-module-eval-source-map', entry: './dev/js/index.js', module: { loaders: [ { test: /\.js$/, loaders: ['babel'], exclude: /node_modules/ }, { test: /\.scss/, loader: 'style-loader!css-loader!sass-loader' } ] }, output: { path: 'src', filename: 'js/bundle.min.js' }, […]

将Express React Redux模板部署到Heroku的步骤

有限的Node和部署到Heroku的经验。 我已经使用这个样板build立了一些东西: https : //github.com/DimitriMikadze/express-react-redux-starter,但我不确定如何设置模板部署到Heroku。 任何基本的步骤将是超级有用的。 谢谢!

反应安装包npm

当我尝试安装npm模块(sendmail)时,我在控制台中有这个: npm ERR! Windows_NT 6.3.9600 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\ProgramFiles\nodejs\node_modules\npm\bin\npm-cli.js" "install" "sendmail" npm ERR! node v4.4.5 npm ERR! npm v2.15.5 npm ERR! code EPEERINVALID npm ERR! peerinvalid The package react@15.3.0 does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer fixed-data-table@0.6.3 wants react@^0.14.0 || ^15.0.0 npm ERR! peerinvalid Peer google-maps-react@1.0.18 wants react@~0.14.8 || […]

我怎样才能编译和运行附加的反应Web应用程序?

我是新的节点和NPM。 我一直在试图编译这个药物提醒应用程序,我发现GitHub( https://github.com/marshallmurphy/Web-Apps/tree/master/Medication%20Reminder%20React%20App ),但npm不断产生错误。 我试过“npm start”并运行“webpack”,但没有运气。 我怎样才能在terminal上编译和运行这个文件? 运行npm start时出现以下错误: Dantes-MBP:Medication Reminder React App dantegreyson$ npm start > medication-reminder-app@1.0.0 start /Users/dantegreyson/Desktop/Medication Reminder React App > webpack-dev-server sh: webpack-dev-server: command not found npm ERR! Darwin 16.1.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start" npm ERR! node v6.9.1 npm ERR! npm v4.0.2 npm ERR! file sh npm ERR! code […]

浏览器控制台错误:无法从“react / lib / ReactAddonsDOMDependencies.js”中find模块“react-dom / lib / ReactPerf”

这在将react-addons-css-transition-group npm包保存为依赖项后,今天开始。 然后,我去了一个更新的兔子洞,添加和删除各种依赖关系,以及确保所有反应相关的依赖关系共享相同的版本。 除了更新之外,我认为我回到了之前添加react-addons-css-transition-group依赖项的位置,但是我仍然遇到了这个错误,而且我在网上找不到与之有关的任何内容。 package.json如果有帮助: { "name": "", "version": "0.1.0", "author": "", "description": "", "license": "MIT", "repository": { "type": "git", "url": "" }, "main": "server.js", "scripts": { "lint": "eslint –ext .js,.jsx –ignore-pattern public", "start": "brunch watch –server", "knex": "knex", "heroku-postbuild": "brunch build –production; knex migrate:latest", "nf": "nf start" }, "dependencies": { "auto-reload-brunch": "^2.7.1", "axios": "^0.14.0", […]

meteor反应错误:无法读取未定义的属性“0”

在使用React的非常简单的Meteor应用程序中,有一张表列出了Meteor.users集合中的所有注册用户。 但是,当试图显示每个用户的电子邮件地址时,浏览器JS控制台正在抛出以下错误,尽pipe电子邮件地址在HTML页面上正确呈现。 Exception from Tracker recompute function: TypeError: Cannot read property '0' of undefined at Users.render (User.jsx:8) 为什么这个错误发生? /imports/ui/User.jsx import React, { Component } from 'react'; export default class Users extends Component { render() { return ( <tr> <td>{ this.props.user._id}</td> <td>{ this.props.user.emails[0].address }</td> // this is line 8 </tr> ) } } /imports/ui/App.jsx import React, […]

未满足的WebPack对等关系问题

所以我有一个奇怪的问题,我试图做一个npm安装在我发现github上的反应/ redux样板解决scheme,但是我得到一些未满足的同行依赖问题。 但是,超级奇怪的是,我读的方式,这些都不是一个问题…我错过了什么? npm ERR! node v4.4.5 npm ERR! npm v2.15.5 npm ERR! code EPEERINVALID npm ERR! peerinvalid The package webpack@2.1.0-beta.21 does not satisfy its siblings' peerDependencies requirements! npm ERR! peerinvalid Peer babel-loader@6.2.5 wants webpack@1 || ^2.1.0-beta npm ERR! peerinvalid Peer extract-text-webpack-plugin@2.0.0-beta.3 wants webpack@^2.1.0-beta npm ERR! peerinvalid Peer sass-loader@4.0.1 wants webpack@^1.12.6 || ^2.1.0-beta npm ERR! […]

AWS backend +响应前端:处理请求

我正在搞AWS,我已经使用dynamodb,api网关和cognito设置了一个简单的REST API。 我用node + express编写了REST API。 我的节点应用程序在EB上,基本上我使用cognito处理API网关中的请求的身份validation。 作为一个独立的,这似乎是正常工作,因为我正在testing它使用一个简单的反应的应用程序。 现在我正在为我的实际反应应用程序做服务器端渲染,所以我试图找出处理这个问题的最佳方法。 对于服务器端渲染,我有另一个名为react-app-server的节点应用程序,我想在API网关上处理caching,并使用cloudfront来提供静态文档,图像等。 所以,如果我去www.mysite.com/for-sale/some-item-thats-for-sale ,这个请求应该首先检查是否有这个页面的caching版本并提供它。 否则,我需要让我的react-app-server呈现.html并提供/caching它。 由于有两个节点应用程序,api-server和react-app-server,我怎么能从我的api-gateway指向react-app-server来呈现html? 这个场景如何适应AWS体系结构? 我意识到这可能是一个非常愚蠢的问题,但我真的很新。 谢谢

问题设置本地heroku环境variables

我正在使用一个heroku应用程序下面的反应buildpack: https : //github.com/mars/create-react-app-buildpack 我在本地运行应用程序时试图在.env文件中设置环境variables,但是应用程序没有select它们。 以下是.env文件的内容: $ cat .env TEST = blap JAWSDB_MARIA_URL = mysql:// ubr638kkc74oaaky:p2ftrun8f5ap41e3@mcldisu5ppkm29wf.cbetxkdyhwsb.us-east-1.rds.amazonaws.com:3306 / kfo3ozwu8gjjl6lh 然而,还有其他的环境variables显示在应用程序中,我不确定这些来自哪里(扩展对象来自console.log(process.env)): 运行“heroku local web”后出现一个控制台消息,似乎表明.env的内容被加载了: