<legend id='y2PNL'><style id='y2PNL'><dir id='y2PNL'><q id='y2PNL'></q></dir></style></legend>

      <small id='y2PNL'></small><noframes id='y2PNL'>

        <bdo id='y2PNL'></bdo><ul id='y2PNL'></ul>

      <tfoot id='y2PNL'></tfoot>
    1. <i id='y2PNL'><tr id='y2PNL'><dt id='y2PNL'><q id='y2PNL'><span id='y2PNL'><b id='y2PNL'><form id='y2PNL'><ins id='y2PNL'></ins><ul id='y2PNL'></ul><sub id='y2PNL'></sub></form><legend id='y2PNL'></legend><bdo id='y2PNL'><pre id='y2PNL'><center id='y2PNL'></center></pre></bdo></b><th id='y2PNL'></th></span></q></dt></tr></i><div id='y2PNL'><tfoot id='y2PNL'></tfoot><dl id='y2PNL'><fieldset id='y2PNL'></fieldset></dl></div>
    2. 如何使用映射 React 从 useState 添加 2 个键?

      时间:2023-09-05

          <tbody id='D3oRO'></tbody>
        • <bdo id='D3oRO'></bdo><ul id='D3oRO'></ul>

            <tfoot id='D3oRO'></tfoot>
            <i id='D3oRO'><tr id='D3oRO'><dt id='D3oRO'><q id='D3oRO'><span id='D3oRO'><b id='D3oRO'><form id='D3oRO'><ins id='D3oRO'></ins><ul id='D3oRO'></ul><sub id='D3oRO'></sub></form><legend id='D3oRO'></legend><bdo id='D3oRO'><pre id='D3oRO'><center id='D3oRO'></center></pre></bdo></b><th id='D3oRO'></th></span></q></dt></tr></i><div id='D3oRO'><tfoot id='D3oRO'></tfoot><dl id='D3oRO'><fieldset id='D3oRO'></fieldset></dl></div>

              <legend id='D3oRO'><style id='D3oRO'><dir id='D3oRO'><q id='D3oRO'></q></dir></style></legend>

                <small id='D3oRO'></small><noframes id='D3oRO'>

              • 本文介绍了如何使用映射 React 从 useState 添加 2 个键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我要做的是在mktrateestimate"中显示currgroupinputrate"和mktratedelta"的添加我想从小处着手,所以我尝试在mktratedelta"输入字段中输入一些内容,然后应该显示此输入在 mktrateestimate 但它不显示 mktratedelta 中的输入.如何解决这个问题以及正确的方法是什么?

                const [marketEstimateDataBCAssets, setmarketEstimateData] = useState([{名称:伦巴第",prevgroupinputrate: 0.01,currgroup 输入率:0.02,mktratedelta:0.03,mktrateestimate: 0.04},{名称:其他担保",prevgroupinputrate: 0.01,currgroup 输入率:0.02,mktratedelta:0.033,mktrateestimate: 0.04},{名称:不安全",prevgroupinputrate: 0.01,currgroup 输入率:0.02,mktratedelta:0.0333,mktrateestimate: 0.04}]);返回 ({marketEstimateDataBCAssets.map((item, key) => {返回 (<段>

                {item.name}</div>

                {item.prevgroupinputrate}</div>

                {item.currgroupinputrate}</div><输入值={item.mktratedelta}onChange={e =>{const newArr = marketEstimateDataBCAssets.map(el => {if (el.name === item.name) {返回 { ...el, mktratedelta: parseFloat(e.target.value) };}返回 el;});控制台.log(newArr);返回 setmarketEstimateData([...newArr]);}}/>

                {marketEstimateDataBCAssets[key].mktrateestimate}</div></段>);})} ```

                解决方案

                你应该试试这样 代码.这只是一个开始,您可以从那里继续自己.您应该找到一种方法来管理您的受控 input.更多阅读 非受控组件 和 受控组件在反应.在 javascript 中查看 parseFloat.

                返回 (<>{marketEstimateDataBCAssets.map((item, key) => (<div 键={item.name}>{/* 让我们的名字是唯一的 *

                <small id='sB6zq'></small><noframes id='sB6zq'>

                  <tbody id='sB6zq'></tbody>
              • <tfoot id='sB6zq'></tfoot>

                  <bdo id='sB6zq'></bdo><ul id='sB6zq'></ul>

                      <legend id='sB6zq'><style id='sB6zq'><dir id='sB6zq'><q id='sB6zq'></q></dir></style></legend>
                        <i id='sB6zq'><tr id='sB6zq'><dt id='sB6zq'><q id='sB6zq'><span id='sB6zq'><b id='sB6zq'><form id='sB6zq'><ins id='sB6zq'></ins><ul id='sB6zq'></ul><sub id='sB6zq'></sub></form><legend id='sB6zq'></legend><bdo id='sB6zq'><pre id='sB6zq'><center id='sB6zq'></center></pre></bdo></b><th id='sB6zq'></th></span></q></dt></tr></i><div id='sB6zq'><tfoot id='sB6zq'></tfoot><dl id='sB6zq'><fieldset id='sB6zq'></fieldset></dl></div>