Tag: reactjs

localForage.setDriver不是一个使用reactx会话的函数

我刚开始使用react-redux-session。 我使用npm安装了相同的代码,并在我的反应应用程序中实现了代码。 但是有一个错误即将到来, localForage.setDriver is not a function 。 我甚至安装了它的依赖( localforage ),但仍然是错误。 我错过了一些必要的步骤? 以下是我称之为的组件。 import App from './containers/App'; import Routes from './Routes'; import appReducer from './reducers'; import { Provider, connect } from 'react-redux'; import { createStore } from 'redux'; import { sessionService } from 'redux-react-session'; let store = createStore(appReducer); const options = { refreshOnCheckAuth: true, […]

ASP.Net MVC项目与办公室用户界面面料反应

我们正试图用asp.net MVC构build一个示例应用程序,使用office ui fabric进行反应。 按照这里提到的从节点js命令提示符下面的步骤。 通过以下步骤,我可以得到正常的反应样品的工作。 我试图在index.tsx文件中添加下面给出的结构UI标签代码,然后运行应用程序,但是结构反应标签组件在浏览器中没有呈现。 index.tsx代码: /* tslint:disable:no-unused-variable */ import * as React from 'react'; /* tslint:enable:no-unused-variable */ import { Label } from 'office-ui-fabric-react/lib/Label'; export const LabelBasicExample = () => ( <div> <Label>I'm a Label</Label> <Label disabled={ true }>I'm a disabled Label</Label> <Label required={ true }>I'm a required Label</Label> </div> ); 添加此代码后,从nodejs命令提示符运行webpack,然后尝试浏览我的index.html,它具有下面的代码。 但看不到反应组件得到渲染,也没有得到任何错误。 […]

如何确保没有导入模块的多个实例

目前正在制作一个RN应用程序,我将把它与Google Analytics和Firebase进行整合。 我将使用这个模块: https : //github.com/idehub/react-native-google-analytics-bridge 我正在构build一个包装类/模块,将联系每个提供商,以便我可以在未来轻松扩展自己的模块。 我的结构如下(每个类扩展了其他):React Component – > BaseComponent – >(Specific Implementation) – > ScreenComponent 由于一个屏幕可以有多个组件,我将把分析包装器放在我的BaseComponent中,将有多个调用我正在构build的分析模块。 对于Java开发中的这个require / exports,我还有点新意,所以对于这个模块来说,会有多个实例创build多个会话。 我正在考虑使分析包装器成为一个全局对象,以确保设置代码只运行一次,并保持会话。 任何input赞赏。

如何在React中使用实验性function?

我正在尝试使用React中的实验性function。 具体反应 – 回电 。 这是包含在React中的一个包,但是当从npm安装最新时, react-call-return不包括在内。 是否有可能从npm安装这个特定的包,而不必克隆整个回购? 这个包确实存在于npm中,但目前还没有被使用: react-call-return 。 关于如何使用这个实验性function的任何想法?

“ER_WRONG_VALUE_COUNT_ON_ROW”

desc表 数据库中默认设置为NULL form.js 提交后发送错误:“ER_WRONG_VALUE_COUNT_ON_ROW” 任何人有一些想法吗?

反应和表示不允许jsx的应用程序

我正在尝试学习如何使用快递制作networking应用程序,但是,我并不真正了解如何将数据发送到客户端,以及快递应该做什么。 我有一个印象,表示应该发送数据到客户端,然后客户端应该根据发送的数据显示UI。 现在我正在尝试使用reactDOMServer来显示一个反应组件,但是我遇到了一个jsx错误: res.send(ReactDOMServer.renderToString(<root />)) SyntaxError: Unexpected token < 我知道这篇文章,并试图安装babel的jsx,但它仍然给我这个错误。 这是我的app.js: const express = require("express") const React = require("react") const ReactDOMServer = require("react-dom/server"); const root = require("./public/root.js"); const app = express(); app.get("/", (req, res) => { res.send(ReactDOMServer.renderToString(<root />)) }) app.listen(3000, () => { console.log("running on port 3000") }) root.js const React = require("react"); module.export = […]

错误:“ReactFifteenAdapter.js”中找不到模块'react-dom / test-utils'“,对于jest-styled-componentsconfiguration,使用了React 15.4.1

仅在使用React版本15.4.1configurationJest-Styled组件时出错。 我们不会升级React版本。 我们只需要configuration上面的反应版本。 我没有安装以下软件包 – 开玩笑风格组件 反应试验渲染器 酶到JSON 酶 – 接合体反应的-15 的package.json { "name": "app", "version": "0.0.1", "description": "", "engines": { "npm": ">=3", "node": ">=5" }, "scripts": { "analyze:clean": "rimraf stats.json", "preanalyze": "npm run analyze:clean", "analyze": "node ./internals/scripts/analyze.js", "extract-intl": "babel-node –presets latest,stage-0 — ./internals/scripts/extract-intl.js", "npmcheckversion": "node ./internals/scripts/npmcheckversion.js", "preinstall": "npm run npmcheckversion", "postinstall": "npm run build:dll", […]

从服务器获取图像后奇怪的页面重新加载

我使用React来select文件input中的一些文件,并将它们作为缓冲区发送到nodejs服务器。 在服务器上我resize,保存图像并发送生成的链接到客户端。 客户端得到的链接,奇怪的重新加载页面,问题是为什么? React类部分: handleClick() { const {send, value} = this.props const {attachments} = this.state if (attachments.length) { send(value, attachments) this.setState({ attachments: [] }) } } addFiles(files) { const {attachments} = this.state const newAttachments = […attachments] Array.prototype.forEach.call(files, file => { if (newAttachments.length < 10) newAttachments.push(file) }) this.setState({ attachments: newAttachments }) } handleDrop(e) { e.preventDefault() this.addFiles(e.dataTransfer.files) […]

构buildReactJS和React本地混合应用程序

我有一个项目,我将需要创build一个共享代码环境来反应和反应原生。 我知道大多数情况下,你不能在两者之间共享表示组件,但我愿意分享一些核心逻辑以及单一代码库中的应用程序结构。 当然,由于React和React Native的打包方式,有一些捕获,我提到的一些解决scheme。 这个想法是使用类似于这个博客文章的逻辑: http : //jkaufman.io/react-web-native-codesharing/ 为了不必担心创build整个构build过程,我创build了一个使用cli来create-react-app和react-native (来自react-native-cli )的初学者包。 https://github.com/ReyHaynes/react-redux-web-native 很明显,使用这种方法会遇到一些问题,但是如果你们可以让我知道这个过程中的一些问题吗? 我很乐意听到他们! 另外,如果您有时间尝试混合构build并查看问题,我也很乐意听到这一点。

将节点升级到v8.9.0后,在React Native中require()中断

在我的React Native应用程序中,我试图require一些静态的PNG缩略图。 根据React Native文档,我使用require加载它们:ie: <View> <TouchableOpacity onPress={() => onPressHandler()}> <Image style={styles.thumbnail} source={require('./toner.png')} /> </TouchableOpacity> <Text style={styles.title}>{props.title}</Text> </View> 这工作正常我的家用机器上使用节点v7.6.0。 但是,它使用Node v8.9.0在我的工作机器上抛出错误。 错误: 无法parsing模块“./toner.png”。 它抱怨该模块不存在,但它! 我猜这是打破节点v8.9.0的东西,但我不积极。 任何想法如何补救将不胜感激!