Skip to content
Advertisement

Tag: reactjs

Issue downloading string as text file

I am trying to download data gotten from a GET request as a .txt file but I keep getting ‘undefined’ as the content of the downloaded file. I only need the data portion of the response. A sample response is provided below as well as my redux action, reducer and my export function My action: my reducer: my download function:

React UseState truthy/falsy

I’m trying to initialize some state for my form component with data from the redux store. If the shippingAddress object is null, I want to set properties of formData object to empty strings. Not sure how to get it to work. Currently I am receiving an error message saying TypeError: Cannot read property ‘address’ of null Answer You could accomplish

‘Illegal invocation’ using input setCustomValidity and TS

I’m pretty much new to Typescript world and am converting one of the first React applications. Here I’m trying to set custom messages on input validation by using event.target.setCustomValidity but I’m getting the ‘Illegal invocation’ error when the setCustomValidity function gets triggered. Here there is the sandbox; To trigger the error it’s just required to update the first input. Debugging

Advertisement