我正在尝试使用redux-saga在react-native中注册firebase回调,但我无法弄清楚如何(我是redux-saga的新手).下面是我想在redux saga中编写的代码:
firebase.auth().onAuthStateChanged((user) => {
if (user) {
console.log('user logged')
}
});
Run Code Online (Sandbox Code Playgroud) 我正在研究 React、Redux 和 Redux-saga,应用程序出现无限循环,请帮忙解决这个问题。
项目.js
import React from "react";
import ReactDOM from "react-dom";
import { Link } from "react-router-dom";
import { gateway as MoltinGateway } from "@moltin/sdk";
import getList from "./../Action/Action";
import { connect } from "react-redux";
//import data from "./data";
export class Item extends React.Component {
constructor(props) {
super(props);
this.state = {};
this.pickItem = this.pickItem.bind(this);
}
pickItem(pickedItem, id) {
//this.props.getList();
//pickedItem.push(id);
//this.setState({ pickItem: pickedItem });
}
componentWillMount() {
this.props.getList();
}
render() {
const { pickedItem } = this.state;
//const …
Run Code Online (Sandbox Code Playgroud) 我有一个index.ts
导出生成器函数的文件
export function* myFunction() { [...] }
Run Code Online (Sandbox Code Playgroud)
它可以正常工作--isolatedModules = false
但无法编译--isolatedModules = true
编译过程中的错误信息:
All files must be modules when the '--isolatedModules' flag is provided. TS1208
Run Code Online (Sandbox Code Playgroud) 当我们需要通过api获取一些数据并且我们在react中使用redux时,我们使用redux-thunk或saga,但我的问题是也可以通过组件useEffect钩子,我们在useEffect中调用api,然后使用redux存储中的action传递数据。