我目前正在学习React Native中的一些redux。但是,如果我试图在一个index.js文件中组合我的reducers,我总是会遇到一个错误。
(0, _redux.combineReducers) is not a function
我看了一些如何使用它的教程,我遵循了每一步,但它一直出现在我的屏幕上。
我的App.js看起来像这样:
import React, { Component } from 'react';
import { Platform, StyleSheet, Text, View } from 'react-native';
imp
我一直试图为“react”npm模块编写一个自定义声明文件,但无法让编译器将我的声明文件解析为该模块。
当我执行import {DateRangePicker} from 'react-dates'时,会得到以下错误:
找不到模块“反应日期”的声明文件。'absolute_path/src/node_modules/react-dates/index.js‘隐式地具有“任意”类型。
我的声明文件位于路径‘@type/ and date/index.d.ts’中,如下所示:
import * as React from 'react';
decla
我正在将测试实现到一个现有的项目中,该项目目前没有测试。我的测试无法编译node_modules/导入。
/Users/me/myproject/node_modules/lodash-es/lodash.js:10
export { default as add } from './add.js';
^^^^^^
SyntaxError: Unexpected token export
at transformAndBuildScript (node_modules/jest-runtime/build/transform.js:320:12)
at Objec
是否有一种方法可以获得应用程序状态的类型检查,而这种状态主要是使用动态还原器生成的?说,在注入动态还原器之前,我应该将它们添加到根还原器类型中。但这不再像我所希望的那样模块化了。
现在,我的根还原程序代码如下所示:
import {combineReducers} from 'redux';
import {auth} from './reducer-auth';
import {user} from './reducer-user';
import {ui} from './reducer-ui';
const appRedu
我正在建立一个有反应的网页。我使用了来自udemy的教程,其中作者使用rest调用的redux承诺。它在课程中起了作用。
在我自己的项目中,我设置了所有相同的东西,当我尝试使用redux承诺中间件创建商店时,在启动该网站时会出现以下错误:
Uncaught TypeError: middleware is not a function
at http://localhost:3000/index.js:34412:16
at Array.map (native)
at http://localhost:3000/index.js:34411:27
at Object.<anonymous
我已经检查了我的代码大约10次,我只是找不到答案。我一直在犯这个错误:
Invariant Violation: Element type is invalid: expected a string but got: undefined
这是我的代码:
App.js
import React from 'react'
import { View, Text } from 'react-native'
import Provider from 'react-redux'
import { createStore } from 'redux&
我试图构建一个简单的cli应用程序,但我得到的文件找不到。如果我在与文件相同的目录下运行,该应用程序运行良好。
在全局安装应用程序之后,它将找不到该文件.npm i -g .
$ tran
Hello World CLI
但是如果切换目录,就找不到文件了。
Error: ENOENT: no such file or directory, open './hello
bin/index.js
#! /usr/bin/env node
import { hello } from '../index.js';
console.log(hello());
index.
我创建了一个新的react-native项目,并编写了一个redux demo.IOS模拟器,显示错误'Expected the reducer to be a function‘。我试图从预览答案中解决这个问题,但不起作用
index.ios.js
import React, {Component} from 'react';
import {AppRegistry, StyleSheet, Text, View} from 'react-native';
import {createStore} from 'redux';
impo
我已经使用npx create- react -app创建了react应用程序。我在public/string文件夹中有json文件。我需要从src.I中的reducer访问这个json文件。我在src/reducers/lang_reducer.js中有如下代码
let resources =require("/strings/strings_" + language + ".json");
let englishStrings=require("/strings/strings_en.json");
引发以下错误:./src/reducers