Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

log errors react

componentDidCatch(error, info) {
    this.reactError = error
    console.log(info)
    this.setState({ catchError: true })    
}


sendError() {
    fetch('/errorlog', {
        headers: {
            'Accept': 'application/json',
            'Content-Type': 'application/json'
        },
        method: "POST",
        body: JSON.stringify({ message: this.props.type + ' - ' + this.props.error.message, stack: this.props.error.stack })
    })
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: How to apply CodeMirror in Bootstrap Modal 
Javascript :: when i send req upload image in node give Error: ENOENT: no such file or directory,ues multer 
Javascript :: react router dom two page form 
Javascript :: must line ending of word regex match 
Javascript :: clima 
Javascript :: check the constructor property to find out if an object is a Date (contains the word "Date"): 
Javascript :: array destructuring mdn 
Javascript :: bar code react native 
Javascript :: email id validation in javascript 
Javascript :: function delete localstorage key with prefix 
Javascript :: get day first 3 letters name in js 
Javascript :: ternary operator online 
Javascript :: delete all properties from an javascript object 
Javascript :: DeleteAsync 
Javascript :: Pignose Calender 
Javascript :: google script delete line 
Javascript :: instantiation javascript 
Javascript :: errorMessage 
Javascript :: After installing a basic setup using above command, install below npm packages 
Javascript :: react first click not working 
Javascript :: /serveur.js 
Javascript :: prototip 
Javascript :: send keypress from iframe to parent 
Javascript :: how to draw and expression tree 
Javascript :: scalling data 1 to 100 in js 
Javascript :: JavaScript : Generate random element of an array : 
Javascript :: apps script openbyName 
Javascript :: argument and parameter 
Javascript :: concat and asign operator js 
Javascript :: flatpicker not focusing in modal React 
ADD CONTENT
Topic
Content
Source link
Name
1+9 =