我有一个简单的React组件,我连接起来(映射一个简单的数组/状态).为了避免引用商店的上下文,我想要一种直接从道具中"调度"的方法.我见过其他人使用这种方法,但由于某种原因无法访问这个:)
以下是我目前正在使用的每个npm依赖项的版本
"react": "0.14.3",
"react-redux": "^4.0.0",
"react-router": "1.0.1",
"redux": "^3.0.4",
"redux-thunk": "^1.0.2"
Run Code Online (Sandbox Code Playgroud)
这是组件w/connect方法
class Users extends React.Component {
render() {
const { people } = this.props;
return (
<div>
<div>{this.props.children}</div>
<button onClick={() => { this.props.dispatch({type: ActionTypes.ADD_USER, id: 4}); }}>Add User</button>
</div>
);
}
};
function mapStateToProps(state) {
return { people: state.people };
}
export default connect(mapStateToProps, {
fetchUsers
})(Users);
Run Code Online (Sandbox Code Playgroud)
如果你需要看减速机(没有什么令人兴奋的,但在这里)
const initialState = {
people: []
};
export default function(state=initialState, action) {
if (action.type === ActionTypes.ADD_USER) {
let newPeople = …Run Code Online (Sandbox Code Playgroud) 在课堂上,我很快就想要导航到indexAction方法.在SublimeText中,我可以按cmd + R,键入"inde",然后在下拉列表中按Enter键,显示搜索的所有结果.
我没有在PhpStorm中找到这个,这个功能是否可用?
这个完整的错误
警告:React.createElement:type不应为null或undefined.它应该是一个字符串(对于DOM元素)或一个ReactClass(对于复合组件).
这就是我在这个观点中所拥有的一切
import React, { Component } from 'react';
import Router, {Link, RouteHandler} from 'react-router';
import { Grid, Row, Column, List, ListItem } from '../../components/Layout';
import { RaisedButton, Paper } from 'material-ui';
const videosInformation = {
time : 25,
gameId : 15665,
date : '12 10 2015',
gameName : "Black Jack"
};
export default class Home extends Component {
static contextTypes = {
router : React.PropTypes.func
}
render () {
return <Grid>
<Row>
<Column>
<Paper>
<List subheader="Player Info">
<ListItem …Run Code Online (Sandbox Code Playgroud) 我有一个python文件,我的机器上保存了以下内容:
types_of_people = 10
x = f"There are {types_of_people} types of people"
binary = "binary"
do_not = "don't"
y = f"Those who know {binary} and those who {do_not}."
print(x)
print(y)
print(f"i said: {x}")
print(f"I also said: '{y}'")
hilarious = False
joke_evaluation = "Isn't that joke so funny?! {}"
print(joke_evaluation.format(hilarious))
w = "This is the left side of ..."
e = "a string with a right side."
print(w + e)
Run Code Online (Sandbox Code Playgroud)
当我从Visual Studio代码中使用Python 3.7打开此文件时出现以下错误:
/usr/local/opt/python/bin/python3.7 /Users/andree/Desktop/test.py
File "<stdin>", line 1
/usr/local/opt/python/bin/python3.7 /Users/andree/Desktop/test.py …Run Code Online (Sandbox Code Playgroud) 我正在使用 Next.js 和 NextAuth.js 进行亚马逊 cognito 设置,我的问题是,当我在注销后立即单击登录链接时,我的用户会直接登录,而不会要求提供凭据。
我的 [...nextauth].ts 看起来像这样:
import NextAuth from 'next-auth';
import CognitoProvider from 'next-auth/providers/cognito';
export const authOptions = {
providers: [
CognitoProvider({
clientId: process.env.COGNITO_CLIENT_ID || '',
clientSecret: process.env.COGNITO_CLIENT_SECRET || '',
issuer: process.env.COGNITO_ISSUER_URL,
}),
],
debug: process.env.NODE_ENV !== 'production' ? true : false,
};
export default NextAuth(authOptions);
Run Code Online (Sandbox Code Playgroud)
对于身份验证,我使用下一个帮助程序方法登录和退出:
interface HomeProps {
appTitle: string;
}
const Home: NextPage<HomeProps> = ({ appTitle }) => {
const { data: session, status } = useSession();
if (status === 'authenticated') {
return …Run Code Online (Sandbox Code Playgroud) Android 平台有 PushNotification 支持吗?文档显示 iOS 支持(https://facebook.github.io/react-native/docs/pushnotificationios.html),但对 Android 没有任何支持。
谢谢 !
我正在测试一个带有ruby,rspec,capybara和selenium的web应用程序,我遇到了一个uninitialized constant ActiveAdminLoginPage我不知道如何解决的异常.
在spec_helper.rb中,我要求以下内容:
Dir[File.join(Dir.pwd, 'spec/page_objects/**/*.rb')].each { |f| require f }
Run Code Online (Sandbox Code Playgroud)
我有2节课
spec/page_objects/products/active_admin_login_page.rb
module Products
class ActiveAdminLoginPage < ::ActiveAdminLoginPage
...
end
end
Run Code Online (Sandbox Code Playgroud)
继承自
spec/page_objects/active_admin_login_page.rb
Run Code Online (Sandbox Code Playgroud)
不幸的是,子类在父类之前加载.
如何从目录中的所有文件名动态创建自动加载命令?我想替换这个命令:
Dir[File.join(Dir.pwd, 'spec/page_objects/**/*.rb')].each { |f| require f }
使用自动加载命令.
曾尝试在Visual Studio代码1.25中将Pylint 1.9.2与Python 3.7和Flask 1.0.2结合使用,
我在代码的第一行上不断在Pylint上收到以下错误。
F0002 ::生成器引发StopIteration
{
"resource": "/d:/social network/models.py",
"owner": "python",
"code": "F0002",
"severity": 8,
"message": "F0002:<class 'RuntimeError'>: generator raised StopIteration",
"source": "pylint",
"startLineNumber": 1,
"startColumn": 1,
"endLineNumber": 1,
"endColumn": 1
}
Run Code Online (Sandbox Code Playgroud)
我完全不知道此错误的原因是什么。
无论我的代码内容如何,都会出现(我尝试过“ import datetime”和从peewee import *,两者都有相同的错误)
仅出现在整个项目的一个文件中。其他文件具有模块导入功能,但此文件没有错误。
如果您知道导致此错误的原因,请提供帮助!
谢谢!
javascript ×2
python ×2
python-3.x ×2
reactjs ×2
android ×1
autoload ×1
exception ×1
ide ×1
next-auth ×1
next.js ×1
phpstorm ×1
pylint ×1
react-native ×1
redux ×1
rspec ×1
ruby ×1
selenium ×1
syntax-error ×1