Homoacademycus

  • Installation
  • TechOpinion
  • TroubleShooting
  • Develop Scripts

react image upload

March 24, 2021

form

  • native html 폼에서 제출 버튼을 누르면 현상태의 input값들을 data 전송 + 페이지 이동
  • react에서는 핸들러 함수로 axios 통신 처리+페이지 이동
  • react는 폼에서도 화면전환없이 데이터를 전달하기 위해서 FormData를 사용
Continue reading

react history push replace

March 24, 2021

Home > Item > Login > Item 순으로 페이지를 이동했을 때 Login 페이지에서 history.push를 사용할 때와 history.replace를 사용할 때의 차이점은 다음과 같다. Push

Continue reading

react fetch axios

March 24, 2021

fetch

let url = 'https://someurl.com';
let options = {
            method: 'POST',
            mode: 'cors',
            headers: {
                'Accept': 'application/json',
                'Content-Type': 'application/json;charset=UTF-8'
            },
            body: JSON.stringify({
                property_one: value_one,
                property_two: value_two
            })
        };
if (response && response.ok) {
    let jsonData = await fetch(url, options).json(); //responseObj.json()
}
  • included in react by default (don’t have to care about module update issue)
  • no response timeout API provided
  • not supported with some browser
  • whend error catched –> always execute .then()
Continue reading

react change port

March 24, 2021

Symtom

react's default dev port is 3000.
I'd like to use another port(80).
Continue reading

react TypeError map function

March 24, 2021

Symtoms

Uncaught TypeError: someState.map is not a function
Continue reading
Prev Next

Copyright with Homoacademycus