analogcoding

6/13 / react 본문

Be well coding/In Immersive

6/13 / react

be well 2019. 6. 14. 23:13


Toy 07번 문제.

 

트리구조의 depth 와 모든 노드를 리턴하는 문제.

 

구현 실패. 

++해결

Tree.prototype.DFSelect = function(filter) {
};
  let result = [];

  function recur(node,depth){
    if(filter(node.value,depth)){
      result.push(node.value)
    }
    if(node.children.length > 0){
      for(let i = 0; i < node.children.length; i++){
        recur(node.children[i],depth+1)
      }
    }
  }
  recur(this,0);
  return result;
}

리액트

 

실시간 검색 기능 구현 성공!

 

리프팅과 디바운스 모두 사용해보았다.

 

setState 로 자식에서 이벤트로 부모 컴포넌트의  state 값을 수정하는 작업에 조금 익숙해졌다.

 

render 의 순서와 리프팅 componentDidMount 같은 메소드 들의 기능 또한 사용해보고 조금 익숙해질 수 있었다.

 

import debounce from "lodash.debounce";

this.searchInput = debounce(this.searchInput, 700);

handleChange(event) {
    this.searchInput(event.target);
  }

  searchInput(e) {
}

낭비를 막고 효율적인 관리를 위해 디바운스를 사용함.

 

'Be well coding > In Immersive' 카테고리의 다른 글

6/15 / react  (0) 2019.06.17
6/14 / react  (0) 2019.06.14
6/12 / react  (0) 2019.06.13
6/11 / review , react  (0) 2019.06.13
6/10 / fetch , client  (0) 2019.06.10
Comments