我需要一个反应路由器v2 +的帮助我必须更改路由更改时的导航栏类例如
我route /profile className将"profile-header"尝试this.props.location在导航栏组件中使用但它显示undefined
希望你的帮助
如何设置defaultValue输入组件?
<Field name={`${prize}.rank`} defaultValue={index} component={Input} type='text'/>
Run Code Online (Sandbox Code Playgroud)
我试过上面但我的领域是空的.我正在尝试创建fieldArray(动态表单):
{fields.map((prize, index) =>
<div key={index} className="fieldArray-container relative border-bottom" style={{paddingTop: 35}}>
<small className="fieldArray-title marginBottom20">Prize {index + 1}
<button
type="button"
title="Remove prize"
className="btn btn-link absolute-link right"
onClick={() => fields.remove(index)}>Delete</button>
</small>
<div className="row">
<div className="col-xs-12 col-sm-6">
<Field name={`${prize}.rank`} defaultValue={index} component={Input} type='text'/>
<Field name={`${prize}.prizeId`} defaultValue={index} component={Input} type='text'/>
<Field
name={`${prize}.name`}
type="text"
component={Input}
label='Prize Name'/>
</div>
<div className="col-xs-12 col-sm-6">
<Field
name={`${prize}.url`}
type="text"
component={Input}
label="Prize URL"/>
</div>
<div className="col-xs-12">
<Field
name={`${prize}.description`}
type="text"
component={Input}
label="Prize Description" /> …Run Code Online (Sandbox Code Playgroud) 打字原稿和react + redux有问题
Could not find a declaration file for module 'react-redux'. '/home/andrew/miramir/src/js/node_modules/react-redux/lib/index.js' implicitly has an 'any' type.
Run Code Online (Sandbox Code Playgroud)
试图从react-redux中获取Provider
import { Provider } from 'react-redux';
Run Code Online (Sandbox Code Playgroud)
我怎么解决它?谢谢
如何在 URL 匹配类型中传递参数?
例如我有/profile/:id它允许我去/profile/1。
但问题是我也可以过去/profile/1qwr/而我什么也得不到。
如何检查 URL 参数的类型并显示错误或其他内容?
我需要获取放在我的反应容器之外的变量的值.
<body>
<div id='react-app'></div>
<script>
var _variable = 3
</script>
</body>
Run Code Online (Sandbox Code Playgroud)
我需要在我的react-component中取这个值,如果可能的话,将这个值存储在Store(redux)中
尝试使用 Lodash 对对象数组进行分组以获得独特的属性
但是undefined如果属性不存在,它就像唯一的属性
有没有办法避免它?只留下现有的属性?
所以我将只实现,My Office 1但通过我的解决方案获取
undefined和My Office 1
示例数组
[
{office: null},
{office:
{
name: 'My Office 1'
}
}
]
Run Code Online (Sandbox Code Playgroud)
代码
Object.keys(_.groupBy(arr, 'office.name')).map((office, index) { ... }
Run Code Online (Sandbox Code Playgroud) 如何将所有js文件合并为一个?随着webpack 1.*的缩小?
这是我的webpack配置的一部分
entry: {
bundle: "./src/index.tsx",
styles: './static/scss/main.scss',
main : [
'./static/js/jquery.js',
'./static/js/bowser.js',
'./static/js/bootstrap.js',
'./static/js/jquery.resizeend.js',
'./static/js/slick.js',
'./static/js/jquery.waypoints.js',
'./static/js/jquery.backgroundpos.js',
'./static/js/jquery.fancybox.js',
'./static/js/select2.full.js',
'./static/js/jquery.mousewheel.js',
'./static/js/clipboard.js',
'./static/js/circle-progress.js',
'./static/js/common.js',
'./static/js/main.js'
]
},
output: {
filename: "[name].js",
path: "../root/js/react",
library: '[name]'
},
Run Code Online (Sandbox Code Playgroud)
构建之后,所有js文件都缩小了但我遇到了这些依赖项的问题:
bootstrap找不到jquery
Uncaught Error: Bootstrap's JavaScript requires jQuery
at Object.1213 (main.js:3)
at t (main.js:1)
at Object.0 (main.js:1)
at t (main.js:1)
at main.0 (main.js:1)
at main.js:1
Run Code Online (Sandbox Code Playgroud)
注意:Jquery在bootstrap之前出现所以它应该没问题
试图async/await与快递一起使用。但是出现错误
const getData = async () => {
^
SyntaxError: Unexpected token (
at createScript (vm.js:56:10)
at Object.runInThisContext (vm.js:97:10)
at Module._compile (module.js:542:28)
Run Code Online (Sandbox Code Playgroud)
节点版本-8.5.0
部分代码
const getData = async () => {
return 'all done';
}
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?谢谢
尝试实现oauth2。卡在顺序交易中。
出现错误:
执行(9edf48f7-5823-4b4f-b444-faa4c1896831):开始交易;
执行(9edf48f7-5823-4b4f-b444-faa4c1896831):COMMIT;
未处理的拒绝错误:此事务已调用提交(9edf48f7-5823-4b4f-b444-faa4c1896831),您将无法再使用它。(拒绝的查询作为此错误的'sql'属性附加)
`
at.save({transaction: t}).then(() => {
rt.save({transaction: t}).then(() => {
t.commit();
return done(false, accessToken, refreshToken, {
expires_at: expires,
scope: scope});
}).error(function(
err) {
t.rollback();
return done(err);
});
}).error(function(err) {
t.rollback();
return done(err);
});
Run Code Online (Sandbox Code Playgroud)
用Postgres序列化4.xx
打字稿有错误
ERROR in [at-loader] ./src/app/components/profile/userProfile/_userMain.tsx:130:37
TS2345: Argument of type 'typeof "/usr/src/app/src/js/src/app/redux/actions/sessionActions"' is not assignable to parameter of type 'ActionCreatorsMapObject'.
ERROR in [at-loader] ./src/app/components/profile/userProfile/_userMain.tsx:133:124
TS2345: Argument of type 'typeof UserProfileMain' is not assignable to parameter of type 'ComponentClass<(state: any) => any> | StatelessComponent<(state: any) => any>'.
Type 'typeof UserProfileMain' is not assignable to type 'StatelessComponent<(state: any) => any>'.
Type 'typeof UserProfileMain' provides no match for the signature '(props: ((state: any) => any) & { children?: ReactNode; }, context?: any): ReactElement<any>'
Run Code Online (Sandbox Code Playgroud)
没有装饰者可以解决这个问题吗?(@connect) …
是否有可能创建带有后缀的模型,如下所示:
var User = sequelize.define('User', {
username: DataTypes.STRING,
email: DataTypes.STRING,
password: DataTypes.STRING,
facebook: {
id: DataTypes.STRING,
token: DataTypes.STRING,
email: DataTypes.STRING,
name: DataTypes.STRING
},
})
Run Code Online (Sandbox Code Playgroud)
想法是:当我从数据库中获取用户数据时,我希望看到用户:{facebook:{id,token,...}}
是否可以更改react-native-navigation标签栏中的图标?
我的意思是,例如,在我的应用程序中我确实调用了api,并且在响应到来之后,我需要将Icon标签栏更改为新的。
例如Heart图标到Mail图标。
感谢任何帮助!
react-native react-native-navigation wix-react-native-navigation
javascript ×9
reactjs ×6
redux ×5
node.js ×2
postgresql ×2
react-router ×2
sequelize.js ×2
typescript ×2
bundle ×1
express ×1
lodash ×1
react-native ×1
redux-form ×1
webpack ×1