如何在React中更新嵌套状态?

时间:2018-05-21 18:28:21

标签: javascript reactjs

我正在尝试更新自定义内部子目录

public static void main(String[] args) {
        int [] numberList = {1,2,3,4,5,6,458,243};

        int initialSequence = -1;
        int endSequence = -5;

        for (int num = 0; num<numberList.length;num++) {
            if(num<numberList.length-1) {
                if(initialSequence == -1 && numberList[num] == numberList[num+1]-1) {
                       initialSequence = endSequence = numberList[num]; 
                    }else if(initialSequence == -1 && numberList[num] != numberList[num+1]-1){
                        System.out.print(numberList[num] + " ");
                    }else if(initialSequence != -1 && numberList[num] == numberList[num+1]-1) {
                        endSequence = numberList[num];
                    }
                    else {
                        System.out.print(initialSequence + "-" + (endSequence+1) + " ");
                        initialSequence = -1;
                        endSequence = -5;
                    }

            }else {
                if(initialSequence == -1) System.out.print(numberList[num] + " ");
                else {
                    System.out.print(initialSequence + "-" + (endSequence+1) + " ");
                }
            }
        }
    }

我的表单看起来像这样

constructor() {
            super();
            this.state = {
                name: '',
                subCatagory: [{ name: '', price: '', customize: [] }],
            };
        }

如何使用react onChange更新内部json值,有没有办法更新react.js中的模型usnig es6?

0 个答案:

没有答案