Apologies if this seems like a beginner question, I am currently learning Javascript and have come across different ways of structuring function declarations. An example below
function mapStateToProps(state) {
console.log(state);
}
const mapStateToProps = state => {
console.log(state);
}
What is the benefit of using one or the other; in which situation would you use one over the other?
Arrow functions are the new ES2015 syntax, for me the main difference is changing this
context you may read about it here https://medium.com/@thejasonfile/es5-functions-vs-es6-fat-arrow-functions-864033baa1a