Never define methods in an object literal via arrow-function.
It's fine to define methods in a Class via arrow-function.
In React it is even recommended to use arrow-functions for defining methods inside React classes as a way to create "auto-binding" methods, e.g. methods that could be used by event handlers but that stayed bound to the class.
I think it's more important to be consistent. If you are using arrow functions to define Class methods, then all class methods should be arrow functions. Similarly if you are using arrow functions for object literals then you should stick with them.
Though, for best practices I usually try to stick with the constraints you have defined. And then keep them consistent across the project.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Are the following statements correct?
Never define methods in an object literal via arrow-function.
It's fine to define methods in a Class via arrow-function.
In React it is even recommended to use arrow-functions for defining methods inside React classes as a way to create "auto-binding" methods, e.g. methods that could be used by event handlers but that stayed bound to the class.
I think it's more important to be consistent. If you are using arrow functions to define Class methods, then all class methods should be arrow functions. Similarly if you are using arrow functions for object literals then you should stick with them.
Though, for best practices I usually try to stick with the constraints you have defined. And then keep them consistent across the project.