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

          <bdo id='YQD7s'></bdo><ul id='YQD7s'></ul>
        <legend id='YQD7s'><style id='YQD7s'><dir id='YQD7s'><q id='YQD7s'></q></dir></style></legend>

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

        将js设置状态从父组件反应到子组件

        react js set state from parent to child component(将js设置状态从父组件反应到子组件)
        1. <tfoot id='heuXk'></tfoot>
            <bdo id='heuXk'></bdo><ul id='heuXk'></ul>

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

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

                  本文介绍了将js设置状态从父组件反应到子组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  所以我有一个父子组件.

                  父母将在搜索栏中输入的任何内容作为道具传递给孩子.

                  然后应该执行 api fetch,我在控制台中看到了 fetch 对象.我在从父级设置子级状态时遇到困难.

                  任何提示将不胜感激,谢谢你和快乐编码:D

                  class HelloComponent 扩展 React.Component {使成为 () {返回 <h1>Github API 存储库 </h1>;}}类父扩展 React.Component {构造函数(道具){超级(道具);this.boo = this.boo.bind(this);this.state = {路径:''};}嘘=(事件)=>{event.preventDefault();//alert('它有效!');让 url = 'https://api.github.com/search/repositories?q='+ this.state.path;//让参数= this.state.path;控制台.log(url);

                  <块引用>

                  我尝试使用 this.props 或只是 this.response..etc

                   axios.get(url).then(响应 => {控制台.log(response.data.items)这个.setState({回购:this.props.response.data.items})})}//从搜索栏设置状态searchQuery = (事件) =>{this.setState({ path : event.target.value });}使成为() {返回(//调用 Repositories 组件并将当前状态作为 props 传递

                  <form onSubmit={this.boo}><input type="text" onChange={this.searchQuery}/><输入类型=提交"值=搜索"/></表格><子搜索= {this.state.path}/>{/* <button onClick={this.boo}>fuck</button>*
                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  在开发JS过程中,会经常遇到两个小数相运算的情况,但是运算结果却与预期不同,调试一下发现计算结果竟然有那么长一串尾巴。如下图所示: 产生原因: JavaScript对小数运算会先转成二进制,运算完毕再转回十进制,过程中会有丢失,不过不是所有的小数间运算会
                  问题描述: 在javascript中引用js代码,然后导致反斜杠丢失,发现字符串中的所有\信息丢失。比如在js中引用input type=text onkeyup=value=value.replace(/[^\d]/g,) ,结果导致正则表达式中的\丢失。 问题原因: 该字符串含有\,javascript对字符串进行了转
                  Rails/Javascript: How to inject rails variables into (very) simple javascript(Rails/Javascript:如何将 rails 变量注入(非常)简单的 javascript)
                  quot;Each child in an array should have a unique key propquot; only on first time render of page(“数组中的每个孩子都应该有一个唯一的 key prop仅在第一次呈现页面时)
                  CoffeeScript always returns in anonymous function(CoffeeScript 总是以匿名函数返回)
                  Ordinals in words javascript(javascript中的序数)

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

                    <tfoot id='KReaw'></tfoot>

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

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

                              <tbody id='KReaw'></tbody>