React.js1 React.js | TypeError: Cannot read property ‘replace’ of undefined TypeError: Cannot read property ‘replace’ of undefined undefined인 객체에 replace 메소드를 호출해서 발생하는 에러다. 값을 받아온 이후에 실행되도록 if문을 추가해서 해결했다. contentId = props.contentId if(contentId) { // props 가 있다면 contentId = contentId.replace() //replace() 메소드 실행 } 2021. 1. 15. 이전 1 다음