JavaScript features for ReactNative

yeji·2021년 7월 27일
0
  • imports and exports
    • 모듈 불러오기, 내보내기
    • node_modules 내에서 모듈의 디렉토리 이름을 가져온다.
  • block-scoped declarations
    • let, const
    • constants with mutable values -> reassigning(x), push(o)
  • arrow functions
    • function: 기명 함수, => : 익명 함수
    • this binding -> this.items.map(x => this.doSomethingWith(x))
    • arguments : arrow functions은 arguments를 가지지 않는다. spread syntax로 사용한다. -> (...args) => doSomething(args[0], args[1])
      • A named function foo is defined as function foo(), which simultaneously introduces the variable name foo into scope. This is different than const foo = () => {}, which introduces the variable name foo pointing to an anonymous function.
  • classes
  • destructuring
  • spread
    • ... merge or copy Objects and Arrays
  • async/await
    • async and await are special syntax for working with promises
    • async function always returns a Promise
      • if return a non-promise value, it's automatically wrapped in Promise.resolve
    • within the function, we can use await to wait for promise to be resolved or rejected and access its value

references:
https://www.reactnative.express/javascript/features/destructuring

profile
🐥

0개의 댓글