Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
brod100267y@timos functional programming in an oop language.. no thanks 🤢
Although I'm sure there's a library for that 😉 -
I'm new to React, but what really helps me to prevent this kind of errors and time wastes to happen is a linter. If you use atom go for "eslint" and the Airbnb config for it.
It would have had recognized the missing curly and shown you the error. :) -
DenRand1687yYes a not so good idea I believe... But what about this:
https://github.com/purescript-contr...
@brod 😀😂 -
@Sirhennihau I'm not new to react and I'm using eslint but it wont notice the error in this case. I have a fields object in state i i.e
fields = {
password: ""
newPassword: ""
etc
}
Then in an let's say onInputChange method you have a variable fields object where you insert all the input values and then you are about to set the state: this.setState(fields) this wont give you any any errors either in react or eslint since fields already is an object, and it will actually update the state, it will jus set the values outside of thw fields object in state and what is missing is the wrapping curlybrackets which are fairly hard to spot. Easy to find the issue during troubbleshooting though, but I was a bit tiered in this scenario :P
React.js WHY WONT THE F%#&ING STATE CHANGE????
3hours later you realize you forgot curlybrackets...
undefined