반응형

Toggle Fullscreen

하나의 버튼으로 전체화면과 일반화면을 토글시키고 싶다면 아래와 같이 사용합니다.

function toggleFullScreen() {
  if (!document.fullscreenElement) {
    document.documentElement.requestFullscreen()
  } else {
    if (document.exitFullscreen) {
      document.exitFullscreen()
    }
  }
}

https://www.cckn.dev/js-ts/20210519-fullscreen/

반응형
반응형

How copy and paste excel columns to HTML table with inputs?

엑셀의 내용 카피해서 웹화면 input에 순서대로 붙여넣기.

 

https://www.codeproject.com/Questions/1212303/How-copy-and-paste-excel-columns-to-HTML-table-wit

 

[Solved] How copy and paste excel columns to HTML table with inputs? - CodeProject

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900

www.codeproject.com

<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>

</head>

<body>
    <table id="example" class="display" cellspacing="0" width="100%">
        <thead>
            <tr>
                <th>Name</th>
                <th>Position</th>
                <th>Office</th>
        </thead>
        <tbody>
            <tr>
                <td><input  type="text"></td>
                <td><input type="text"></td>
                <td><input  type="text"></td>
            </tr>
            <tr>
                <td><input type="text"></td>
                <td><input type="text"></td>
                <td><input type="text"></td>
            </tr>
            <tr>
                <td><input type="text"></td>
                <td><input type="text"></td>
                <td><input type="text"></td>
            </tr>
        </tbody>
    </table>

    <script>
        $(document).ready(function () {
            $('td input').bind('paste', null, function (e) {
                $txt = $(this);
                setTimeout(function () {
                    var values = $txt.val().split(/\s+/);
                    var currentRowIndex = $txt.parent().parent().index();
                    var currentColIndex = $txt.parent().index(); 
                    
                    var totalRows = $('#example tbody tr').length;
                    var totalCols = $('#example thead th').length;
                    var count =0;
                    for (var i = currentColIndex; i < totalCols; i++) {
                        if (i != currentColIndex)
                            if (i != currentColIndex)
                                currentRowIndex = 0;
                        for (var j = currentRowIndex; j < totalRows; j++) {                           
                            var value = values[count];
                            var inp = $('#example tbody tr').eq(j).find('td').eq(i).find('input');
                            inp.val(value);
                            count++;
                           
                        }
                    }


                }, 0);
            });
        });
    </script>

</body>
</html>

 

반응형
반응형

 

javascript 숫자 세자리 콤마 제거하기 comma

const numberStr = "123,456,789";

// 전체 콤마 제거
const number = numberStr.replace(/,/g, "");
document.write(number);

 

ASP 숫자형 리턴 - 숫자인지 문자인지 알수 없어서 formatnumber를 적용 못할때 해당 function으로 적용해본다. 

 
 Function My_IsNumeric(value)
    My_IsNumeric = False
    If IsNull(value) Then Exit Function
    My_IsNumeric = IsNumeric(CStr(value))
End Function



        if( len(view_val_acc) > 0 and My_IsNumeric(view_val_acc) = True )then 
            view_val_acc = formatNumber(view_val_acc,0)
        end if 
        'response.write "*"& view_val_acc

 

반응형
반응형

ES6 for beginners
https://hackernoon.com/es6-for-beginners-f98120b57414

 

ES6 for beginners | HackerNoon

 

hackernoon.com

Topics I’m gonna cover in this post

  1. Let and Const
  2. Arrow functions
  3. Default parameters
  4. for of loop
  5. Spread attributes
  6. Maps
  7. Sets
  8. Static methods
  9. Getters and Setters

ES6 문법 + 활용 패턴 살펴보기
https://chancethecoder.tistory.com/30

  • 블록 범위 생성자 (Block-Scoped Constructs Let and Const)
  • 화살표 함수 (Arrow Functions)
  • 클래스 (Classes)
  • 프로미스 (Promises)
  • 비구조화 할당 (Destructuring Assignment)
  • 템플릿 리터럴 (Template Literals)
  • 향상된 객체 리터럴 (Enhanced Object Literals)
  • 기본 매개 변수 (Default Parameters)
  • 멀티 라인 문자열 (Multi-line Strings)
  • 모듈 (Modules)

자주 사용하는 ES6 문법 정리
https://velog.io/@kimhscom/JavaScript-%EC%9E%90%EC%A3%BC-%EC%82%AC%EC%9A%A9%ED%95%98%EB%8A%94-ES6-%EB%AC%B8%EB%B2%95-%EC%A0%95%EB%A6%AC

 

  1. 기본 매개 변수 (Default Parameters)
  2. 템플릿 리터럴 (Template Literals)
  3. 멀티 라인 문자열 (Multi-line Strings)
  4. 비구조화 할당 (Destructuring Assignment)
  5. 향상된 객체 리터럴 (Enhanced Object Literals)
  6. 화살표 함수 (Arrow Functions)
  7. Promises
  8. 블록 범위 생성자 Let 및 Const (Block-Scoped Constructs Let and Const)
  9. 클래스 (Classes)
  10. 모듈 (Modules)

 

.

개발자가 필히 알아야 할 ES6 10가지 기능

https://blog.asamaru.net/2017/08/14/top-10-es6-features/

 

개발자가 필히 알아야 할 ES6 10가지 기능

ES6(ECMAScript 표준의 6번째 에디션, ECMAScript2015)에 대한 이야기를 하기 전에 자바스크립트와 ECMAScript에 대한 것부터 간략히 소개한다. 넷스케이프(Netscape)에서 1995년 개발한 자바스크립트(javascript)

blog.asamaru.net

ES6(ECMAScript 표준의 6번째 에디션, ECMAScript2015)에 대한 이야기를 하기 전에 자바스크립트와 ECMAScript에 대한 것부터 간략히 소개한다.

넷스케이프(Netscape)에서 1995년 개발한 자바스크립트(javascript)는 웹 브라우저에서 동적인 기능을 제공하기 위한 언어다. 현재는 대부분의 브라우저에서 이 언어를 제공하고 있다. 그런데 표준 규격없이 여러 브라우저에서 독자적인 특성이 추가되면서 호환성 문제가 발생하기 시작했다. 이에 ECMA 국제 기구에서 “ECMAScript Standard”라는 표준을 만들게 되었다. 정확히 이야기 하자면 현재의 자바스크립트는 ECMAScript와 BOM(Browser Object Model)와 DOM(Document Object Model)을 포괄하는 개념이다.

개별적인 설명에 앞서 개발자가 필히 알아야 할 ES6 10가지 기능을 나열하자면 아래와 같다.

  1. 기본 매개 변수 (Default Parameters)
  2. 템플릿 리터럴 (Template Literals)
  3. 멀티 라인 문자열 (Multi-line Strings)
  4. 비구조화 할당 (Destructuring Assignment)
  5. 향상된 객체 리터럴 (Enhanced Object Literals)
  6. 화살표 함수 (Arrow Functions)
  7. Promises
  8. 블록 범위 생성자 Let 및 Const (Block-Scoped Constructs Let and Const)
  9. 클래스 (Classes)
  10. 모듈 (Modules)

 

1. 기본 매개 변수 (Default Parameters)

var link = function (height, color, url) {
    var height = height || 50
    var color = color || 'red'
    var url = url || 'http://azat.co'
    ...
}

함수에 넘겨주는 인자값에 대한 default 처리를 위해 위와 같이 처리 했었다면 ES6에서는 아래와 같이 간단히 처리할 수 있다.

var link = function(height = 50, color = 'red', url = 'http://azat.co') {
  ...
}

단, 주의해야 할 점이 있다. 인자값으로 0 또는 false가 입력될 때 두 예시의 결과는 다르다. ES5에서는 || 처리 시 0 또는 false 값이 입력 되어도 거짓이 되므로 기본값으로 대체된다. 하지만 ES6의 기본 매개 변수를 사용하면 undefined 를 제외한 입력된 모든 값(0, false, null 등)을 인정한다.

2. 템플릿 리터럴 (Template Literals)

ES5에서는 아래와 같이 문자열을 처리해야 했다.

var name = 'Your name is ' + first + ' ' + last + '.'
var url = 'http://localhost:3000/api/messages/' + id

하지만 ES6에서는 템플릿 리터럴을 제공하므로 "`" (back-ticked) 문자열 안에 ${NAME}라는 새로운 구문을 사용해서 아래와 같이 간단히 처리할 수 있다.

var name = `Your name is ${first} ${last}.`
var url = `http://localhost:3000/api/messages/${id}`

3. 멀티 라인 문자열 (Multi-line Strings)

ES5에서는 멀티 라인 문자열을 처리하기 위해 아래와 같은 방법들을 사용해야 했다.

var roadPoem = 'Then took the other, as just as fair,\n\t'
    + 'And having perhaps the better claim\n\t'
    + 'Because it was grassy and wanted wear,\n\t'
    + 'Though as for that the passing there\n\t'
    + 'Had worn them really about the same,\n\t'

var fourAgreements = 'You have the right to be you.\n\
    You can only be you when you do your best.'

하지만 ES6에서는 "`" (back-ticked) 문자열을 이용해서 아래와 같이 간단히 처리할 수 있다.

var roadPoem = `Then took the other, as just as fair,
    And having perhaps the better claim
    Because it was grassy and wanted wear,
    Though as for that the passing there
    Had worn them really about the same,`

var fourAgreements = `You have the right to be you.
    You can only be you when you do your best.`

4. 비구조화 할당 (Destructuring Assignment)

ES5에서는 구조화된 데이터를 변수로 받기 위해 아래와 같이 처리해야 했다.

// browser
var data = $('body').data(), // data has properties house and mouse
  house = data.house,
  mouse = data.mouse

// Node.js
var jsonMiddleware = require('body-parser').json

var body = req.body, // body has username and password
  username = body.username,
  password = body.password

하지만 ES6에서는 비구조화 할당을 사용해 아래와 같이 처리할 수 있다.

var {house, mouse} = $('body').data() // we'll get house and mouse variables

var {jsonMiddleware} = require('body-parser')

var {username, password} = req.body

주의할 점은 var로 할당하려는 변수명과 구조화된 데이터의 property명이 같아야 한다. 또한 구조화된 데이터가 아니라 배열의 경우 {} 대신 []를 사용해서 위와 유사하게 사용할 수 있다.

var [col1, col2]  = $('.column'),
  [line1, line2, line3, , line5] = file.split('\n')

5. 향상된 객체 리터럴 (Enhanced Object Literals)

ES5에서는 아래와 같이 JSON을 사용해서 객체 리터럴을 만들 수 있었다.

var serviceBase = {port: 3000, url: 'azat.co'},
    getAccounts = function(){return [1,2,3]}

var accountServiceES5 = {
  port: serviceBase.port,
  url: serviceBase.url,
  getAccounts: getAccounts,
  toString: function() {
    return JSON.stringify(this.valueOf())
  },
  getUrl: function() {return "http://" + this.url + ':' + this.port},
  valueOf_1_2_3: getAccounts()
}

위 예시와 달리 serviceBase를 확장하길 원한다면 Object.create 로 프로토타입화하여 상속 받을 수 있다.

var accountServiceES5ObjectCreate = {
  getAccounts: getAccounts,
  toString: function() {
    return JSON.stringify(this.valueOf())
  },
  getUrl: function() {return "http://" + this.url + ':' + this.port},
  valueOf_1_2_3: getAccounts()
}
accountServiceES5ObjectCreate.__proto__ = Object.create(serviceBase)

accountServiceES5ObjectCreate와 accountServiceES5는 동일하게 사용할 수 있으나 다른 구조를 가진다. accountServiceES5ObjectCreate는 accountServiceES5와 다르게 __proto__  port  url 속성을 가진 객체를 담고 있다.

ES6에서는 아래와 같이 처리할 수 있다.

var serviceBase = {port: 3000, url: 'azat.co'},
    getAccounts = function(){return [1,2,3]}
var accountService = {
    __proto__: serviceBase,
    getAccounts,
    toString() {
     return JSON.stringify((super.valueOf()))
    },
    getUrl() {return "http://" + this.url + ':' + this.port},
    [ 'valueOf_' + getAccounts().join('_') ]: getAccounts()
};

위 예시에 대해 ES5와의 차이를 요약하면 아래와 같다.

  • __proto__ 속성을 사용해서 바로 프로토타입을 설정할 수 있다.
  • getAccounts: getAccounts, 대신 getAccounts, 를 사용할 수 있다 (변수명으로 속성 이름을 지정).
  • [ 'valueOf_' + getAccounts().join('_') ] 와 같이 동적으로 속성 이름을 정의할 수 있다.

조금 더 자세한 내용을 보고 싶다면 gsfe/es2015features 를 참고하자.

6. 화살표 함수 (Arrow Functions)

화살표 함수는 항상 익명 함수이며 this의 값을 현재 문맥에 바인딩 시킨다.

아래의 예시는 화살표 함수가 지원되지 않는 ES5에서 this를 사용하기 위한 처리 예시다.

var _this = this
$('.btn').click(function(event){
  _this.sendData()
})

다음은 위 예시를 화살표 함수로 대체한 ES6 예시이다.

$('.btn').click((event) => {
  this.sendData()
})

다음은 ES5에서 call을 사용하여 context를 logUpperCase() 함수에 전달하는 또 다른 예제다.

var logUpperCase = function() {
  var _this = this

  this.string = this.string.toUpperCase()
  return function () {
    return console.log(_this.string)
  }
}
logUpperCase.call({ string: 'es6 rocks' })()

ES6에서는 화살표 함수를 사용하면 _this 를 사용할 필요가 없다.

var logUpperCase = function() {
  this.string = this.string.toUpperCase()
  return () => console.log(this.string)
}
logUpperCase.call({ string: 'es6 rocks' })()

화살표 함수가 한 줄의 명령문과 함께 사용되면 표현식이 되어 명령문의 결과를 암시적으로 반환한다.

ES5에서의 처리 예시.

var ids = ['5632953c4e345e145fdf2df8','563295464e345e145fdf2df9']
var messages = ids.map(function (value) {
  return "ID is " + value // explicit return
});

ES6에서의 처리 예시.

var ids = ['5632953c4e345e145fdf2df8','563295464e345e145fdf2df9']
var messages = ids.map(value => `ID is ${value}`) // implicit return

여러 개의 인자를 사용하는 경우는 변수 목록을 () 로 감싸줘야 한다.

ES5에서의 처리 예시.

var ids = ['5632953c4e345e145fdf2df8', '563295464e345e145fdf2df9'];
var messages = ids.map(function (value, index, list) {
  return 'ID of ' + index + ' element is ' + value + ' ' // explicit return
});

ES6에서의 처리 예시.

var ids = ['5632953c4e345e145fdf2df8','563295464e345e145fdf2df9']
var messages = ids.map((value, index, list) => `ID of ${index} element is ${value} `) // implicit return

또한 본문을 괄호로 감싸 객체 표현식을 반환할 수 있으며 ... 을 이용해 가변 파라미터를 사용할 수도 있다.

var ids = ['5632953c4e345e145fdf2df8','563295464e345e145fdf2df9']
var messages = ids.map((value, index, ...abc) => ({v:value, i:index, a:abc}))

7. Promises

ES6에서는 표준 Promise가 제공된다.

아래는 setTimeout 을 이용한 지연된 비동기 실행에 대한 ES5 예시다.

setTimeout(function(){
  console.log('Yay!')
}, 1000)

위 예시를 ES6에서 Promise를 사용해서 재작성하면 아래와 같다.

var wait1000 =  new Promise(function(resolve, reject) {
  setTimeout(resolve, 1000)
}).then(function() {
  console.log('Yay!')
})

위 예시를 화살표 함수를 사용해 재작성한 예시는 아래와 같다.

var wait1000 =  new Promise((resolve, reject)=> {
  setTimeout(resolve, 1000)
}).then(()=> {
  console.log('Yay!')
})

ES5 보다 ES6의 Promise를 사용한 예시가 더 복잡해 보이지만 아래와 같이 중첩된 setTimeout 예시를 보면 Promise의 이점을 확인할 수 있다.

setTimeout(function(){
  console.log('Yay!')
  setTimeout(function(){
    console.log('Wheeyee!')
  }, 1000)
}, 1000)

아래는 ES6 Promise 로 작성된 예시.

var wait1000 =  ()=> new Promise((resolve, reject)=> {setTimeout(resolve, 1000)})

wait1000()
    .then(function() {
        console.log('Yay!')
        return wait1000()
    })
    .then(function() {
        console.log('Wheeyee!')
    });

조금 더 자세한 내용을 보고 싶다면 Introduction to ES6 Promises – The Four Functions You Need To Avoid Callback Hell 또는 gsfe/es2015features 를 참고하자.

8. 블록 범위 생성자 Let 및 Const (Block-Scoped Constructs Let and Const)

let과 const는 중괄호("{}")로 정의된 블록으로 유효 범위(스코프)를 지정하는 새로운 var이다. 단, let은 변수를 const는 상수를 선언한다.

function calculateTotalAmount (vip) {
  var amount = 0
  if (vip) {
    var amount = 1
  }
  { // more crazy blocks!
    var amount = 100
    {
      var amount = 1000
      }
  }
  return amount
}
console.log(calculateTotalAmount(true))

위 예시의 결과는 1000 이다. var는 전역 또는 함수 내부로 유효 범위를 갖기 때문에 예시에 사용된 함수 내부의 "{}" 들은 아무런 역할을 하지 못한다. 아래는 위 예시에서 var를 let으로 바꾼 ES6 예시다.

function calculateTotalAmount (vip) {
  var amount = 0 // probably should also be let, but you can mix var and let
  if (vip) {
    let amount = 1 // first amount is still 0
  }
  { // more crazy blocks!
    let amount = 100 // first amount is still 0
    {
      let amount = 1000 // first amount is still 0
      }
  }
  return amount
}
console.log(calculateTotalAmount(true))

이 예시의 결과는 0 이다. let 으로 선언된 변수는 "{}" 블록 내부로 유효 범위가 한정되므로 100, 1000으로 할당된 변수는 해당 블록 내부에서만 유효하기 때문이다. if 블록 내부에서 let으로 선언된 amount 또한 해당 if 블록 내에서만 유효하므로 아무런 변경이 일어나지 않는다.

아래의 예시는 const를 사용한 예시다. const는 상수를 선언하는 것으로 여러번 선언될 수 없지만 let과 같이 블록 내부로 유효 범위가 한정되므로 아래의 예시는 오류가 발생하지 않는다.

function calculateTotalAmount (vip) {
  const amount = 0
  if (vip) {
    const amount = 1
  }
  { // more crazy blocks!
    const amount = 100
    {
      const amount = 1000
      }
  }
  return amount
}
console.log(calculateTotalAmount(true))

9. 클래스 (Classes)

ES6에는 class 키워드가 추가되어 ES5의 prototype 기반 상속보다 명확하게 class를 정의할 수 있다. get  set 키워드 외에도 static 키워드를 사용해 static 메소드를 정의하는 것도 가능하다.

class baseModel {
  constructor(options = {}, data = []) { // class constructor
        this.name = 'Base'
    this.url = 'http://azat.co/api'
        this.data = data
    this.options = options
    }

    getName() { // class method
        console.log(`Class name: ${this.name}`)
    }
}

constructor 는 class 내부에 하나만 존재할 수 있으며 메소드 정의에 function 또는 콜론(":")이 더이상 필요하지 않다. 단, property의 경우 메소드와 달리 생성자에서 값을 할당해야 한다.

또한 아래의 예시와 같이 class NAME extends PARENT_NAME 형식으로 상속이 가능하다. 상속시 부모 생성자를 호출하기 위해 super() 를 사용할 수 있다. 생성자가 아닌 메소드에서는 super 키워드를 사용해서 부모 메소드에 접근한다.

class AccountModel extends baseModel {
    constructor(options, data) {
      super({private: true}, ['32113123123', '524214691']) //call the parent method with super
      this.name = 'Account Model'
      this.url +='/accounts/'
    }

    get accountsData() { //calculated attribute getter
      // ... make XHR
      return this.data
    }
}

class 는 get  set 키워드를 사용할 수 있으며 선언된 함수는 아래와 같이 사용할 수 있다.

let accounts = new AccountModel(5)
accounts.getName()
console.log('Data is %s', accounts.accountsData)

위 예시를 실행하면 아래와 같은 결과를 얻을 수 있다.

Class name: Account Model
Data is %s 32113123123,524214691

10. 모듈 (Modules)

ES6 에서 모듈을 공식적으로 제공하기 전까지는 CommonJS, AMD, RequireJS 등의 비공식 모듈 스펙을 사용해 왔다. ES6에서 제공하는 모듈 스펙은 기존과 유사하지만 차이가 있다.

ES5에서 CommonJS를 이용해서 모듈을 사용하는 예시는 아래와 같다(module.js).

module.exports = {
  port: 3000,
  getAccounts: function() {
    ...
  }
}

main.js 파일에서 위에서 정의한 모듈을 불러서 사용하는 예시는 아래와 같다.

var service = require('module.js')
console.log(service.port) // 3000

여기서 부터는 ES6의 import  export 를 사용해서 유사한 기능을 구현한 예시다(module.js).

export var port = 3000
export function getAccounts(url) {
  ...
}

main.js 파일에서는 import 를 사용해서 module.js 모듈을 불러올 수 있다.

import {port, getAccounts} from 'module'
console.log(port) // 3000

위와 유사하지만 export 된 모든 변수를 아래와 같이 하나의 구조화된 데이터로 받을 수도 있다.

import * as service from 'module'
console.log(service.port) // 3000

ES6 당장 사용할 수 있는 방법 (Babel)

ES6는 확정되었지만 아직 모든 브라우저에서 완전하게 지원되지 않는다. 따라서 지금 당장 ES6 사용하고 싶다면 Babel과 같은 컴파일러를 사용해야 한다. Babel은 독립 실행형 도구로 실행하거나 빌드 시스템에서 사용할 수 있다. Grunt, Gulp  Webpack 용 Babel 플러그인이 있다.

ES6의 기타 특징

참고로 이 외에도 여러가지 특징이 있으니 관심이 있다면 git.io/es6features를 번역한 ECMAScript 6 Features를 참고하면 된다.

반응형
반응형

 

https://github.com/enaqx/awesome-react

 

GitHub - enaqx/awesome-react: A collection of awesome things regarding React ecosystem

A collection of awesome things regarding React ecosystem - GitHub - enaqx/awesome-react: A collection of awesome things regarding React ecosystem

github.com

React를 배우는 방법 — 초급에서 고급까지의 로드맵

https://medium.com/free-code-camp/learning-react-roadmap-from-scratch-to-advanced-bff7735531b6

 

How to Learn React — A roadmap from beginner to advanced

Hey folks!!

medium.com

안녕하세요 여러분!!

이 가이드는 React를 시작하는 사람들을 위한 것입니다. 더 쉽게 배울 수 있도록 각 섹션에서 최고의 비디오와 기사를 신중하게 선별했습니다.

참고: 저는 아래에 언급된 웹사이트와 관련이 없습니다. 순전히 제 견해입니다.

전제 조건

  1. HTML, CSS 및 JavaScript에 대한 기본 지식.
  2. ES6 기능에 대한 기본 이해. 다음 은 ES6 기능 중 일부를 설명하는 기사 입니다.
    시작하려면 최소한 다음 기능을 알고 있어야 합니다.
    1. Let
    2. Const
    3. 화살표 함수
    4. 가져오기 및 내보내기
    5. 클래스
  3. npm 사용 방법에 대한 기본 이해 .

시작하기

온라인 코드 편집기를 사용하여 연습하거나 Create React App 을 사용할 수 있습니다 .

JSFiddle  Codepen 에서 개발 환경을 설정했습니다 .

React의 모든 기본 사항을 이해하려면 다음 자습서부터 시작할 수 있습니다.

React 의 React 공식 문서

Kent C. Dodds 의 React 초보자 가이드

React의 기초 by

지금쯤이면 React의 기본 사항에 대한 기본 아이디어를 얻었을 것입니다. React에서 간단한 웹 앱 개발을 시작하는 것으로 충분합니다.

이제 React 공식 튜토리얼을 살펴보십시오.

React 의 React 공식 튜토리얼

React의 기초를 다루는 잘 작성된 기사입니다. 또한 특정 주제를 매우 명확하게 설명합니다.

마지막으로 React 앱으로 API에 연결하는 방법을 배우십시오.

React.js 로 API 가져오기

일부 프로젝트 구축 시작

  1. 간단한 할일 앱
  2. 간단한 계산기 앱
  3. 장바구니 만들기
  4. GitHub API를 사용하여 GitHub의 사용자 통계 표시

반응 라우터

React Router는 단일 페이지 애플리케이션에 대한 경로를 생성하는 데 도움이 됩니다. 매우 강력하고 React 애플리케이션과 함께 사용하기 쉽습니다.

시작하려면:

React Router 튜토리얼

React Router 및 Learn Code Academy 의 SPA 소개

Scotch.io의 React 앱 라우팅

이 기사는 React 라우팅을 시작하기에 충분합니다.

프로젝트

  1. 간단한 CURD 애플리케이션
  2. 해커 뉴스 클론

라우터에 대해 자세히 알고 싶다면 다음 가이드를 확인하세요.

React Training의 React Router 전체 가이드

웹팩

Webpack은 유명한 JavaScript 모듈 번들러입니다. Webpack은 개발자가 할 필요가 없도록 프로젝트에 대한 정적 파일로 종속성을 유지하는 데 도움이 됩니다.

Webpack에는 로더도 함께 제공됩니다. 로더는 프로젝트와 관련된 특정 작업을 실행하는 데 도움이 됩니다.

Webpack에 대해 자세히 알아보려면 다음 자습서를 따르십시오.

Andrew Ray의 Webpack을 사용해야 하는 시기와 이유

Learn Code Academy의 Webpack 튜토리얼

Webpack을 사용하여 로컬 React 환경을 설정하려면 다음 GitHub 리포지토리를 참조하세요.

Hanif Roshan의 React SPA 템플릿

위의 튜토리얼은 Webpack을 시작하기에 충분하다고 생각합니다. 그러나 심층 지식을 얻으려면 다음 가이드를 참조하십시오.

SurviveJS의 Webpack 소개

웹팩 공식 문서

서버 렌더링

서버 렌더링은 React의 가장 멋진 기능 중 하나입니다. 모든 백엔드 기술과 함께 사용할 수 있습니다.

React의 SSR(Server Side Rendering)을 사용하면 서버에서 구성 요소를 만들고 브라우저에서 HTML로 렌더링할 수 있습니다. 그리고 모든 JavaScript 모듈이 브라우저에 다운로드되면 React가 무대를 차지합니다. 단순한!

먼저 React-DOM API를 살펴보십시오.

React의 React -DOM API

그리고 아래 튜토리얼에 따라 심층 지식을 얻으세요.

Tyler McGinnis의 React 서버 렌더링

React 라우터 서버 렌더링

React Server 측 렌더링 가이드

리덕스

Redux는 애플리케이션 상태를 유지하기 위해 개발된 JavaScript 라이브러리입니다. 복잡한 응용 프로그램을 빌드할 때 구성 요소 간에 상태를 관리하기 위해 오버헤드가 추가됩니다. Redux를 사용하면 모든 상태를 단일 소스에 저장할 수 있습니다. 물론 React는 Redux와 잘 어울립니다. :)

시작하려면:

Learn Code Academy의 Redux 튜토리얼

Valentino Gagliardi 의 초보자를 위한 Redux 튜토리얼

CSS 트릭으로 Redux에 반응 하기

이 튜토리얼은 Redux를 시작하기에 충분합니다. 그러나 아래 튜토리얼도 언급하지 않을 수 없습니다. 그것은 가치 :)

Dan Abramov 의 Redux 시작하기

 

 

https://www.instagram.com/p/CY31EqdqPrp/?utm_source=ig_web_copy_link

 

반응형
반응형

Object.assign()

 

https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Object/assign

 

Object.assign() - JavaScript | MDN

Object.assign() 메서드는 출처 객체들의 모든 열거 가능한 자체 속성을 복사해 대상 객체에 붙여넣습니다. 그 후 대상 객체를 반환합니다.

developer.mozilla.org

Object.assign()

Object.assign() 메서드는 출처 객체들의 모든 열거 가능 자체 속성을 복사해 대상 객체에 붙여넣습니다. 그 후 대상 객체를 반환합니다.

const target = { a: 1, b: 5 };
const source = { b: 7, c: 5 };

const returnedTarget = Object.assign(target, source);

console.log(target);
// expected output: Object { a: 1, b: 4, c: 5 }

console.log(returnedTarget);
// expected output: Object { a: 1, b: 4, c: 5 }
반응형
반응형

자바스크립트로 현재시간 timestamp 구하기

console.log( new Date().getTime() );
 

 

반응형
반응형

getDay() 메서드는 지정된 날짜의 요일(0~6)을 반환합니다.

var d = new Date();
var n = d.getDay();

getDay() 메서드는 지정된 날짜의 요일(0~6)을 반환합니다.

참고: 일요일은 0, 월요일은 1 등입니다.

var d = new Date();
var weekday = new Array(7);
weekday[0] = "Sunday";
weekday[1] = "Monday";
weekday[2] = "Tuesday";
weekday[3] = "Wednesday";
weekday[4] = "Thursday";
weekday[5] = "Friday";
weekday[6] = "Saturday";

var n = weekday[d.getDay()];

 

https://www.w3schools.com/js/js_date_methods.asp

 

JavaScript Get Date Methods

Method Description
getFullYear() Get the year as a four digit number (yyyy)
getMonth() Get the month as a number (0-11)
getDate() Get the day as a number (1-31)
getHours() Get the hour (0-23)
getMinutes() Get the minute (0-59)
getSeconds() Get the second (0-59)
getMilliseconds() Get the millisecond (0-999)
getTime() Get the time (milliseconds since January 1, 1970)
getDay() Get the weekday as a number (0-6)
Date.now() Get the time. ECMAScript 5.

 

 

반응형

+ Recent posts