我在React中有一个复杂的对象,无法理解如何从已检查的输入中获取价值。有一段带有输入的代码。我需要添加输入检查值,而不是单词“输入值”。
const ClientForm = React.createClass({
.....
render: function() {
......
return(
< AgForm.Input >
< label className = 'myLabel' >
< input className = "valueBroker"
disabled = {
readOnly
}
type = 'checkbox'
name = 'is_broker'
onChange = {
this.form().checkbox('is_broker', true)
}
checked = {
_isTrue(this.form().value('is_broker'))
}
/>
Agent < /label> < /AgForm.InputLine> < AgForm.InputLine error = {
errors.system
}
/> < /div>
module.exports = AddClientForm;
const ClientListItem = React.createClass({
render() {
return
<div >
Input value {
(client.kind_name || …Run Code Online (Sandbox Code Playgroud) 我有一个有趣的任务.我解决了一半,但无法找到解决其余问题的解决方案.希望有人能指出我正确的方向.
我发现解决方案接近我的任务.但我的略有不同,使用ES6.
有嵌套对象.
let someList = {
value: 1,
next: {
value: 2,
next: {
value: 3,
next: {
value: 4,
next: null
}
}
}
};
Run Code Online (Sandbox Code Playgroud)
我收到了所有价值观.
function reversePrint(linkedList) {
Object.keys(linkedList).map(key => {
let myKey = linkedList[key];
typeof myKey == "object" ? console.log(reversePrint(myKey)) : console.log(myKey);
});
}
reversePrint(someList);
Run Code Online (Sandbox Code Playgroud)
但问题是:我如何以相反的顺序获得所有值?
小提琴:https://jsfiddle.net/L83puqbz/17/
我尝试使用reduce来生成数组并反转它,但每个值都在单独的数组中.
小提琴https://jsfiddle.net/L83puqbz/20/
任何帮助都将受到极大的关注.