Sunday, 14 February 2021

Should I use useselector instead of mapStateToProps

When creating a React app, if I use the hook useSelector, I need to adhere to the hooks invoking rules (Only call it from the top level of a functional component). If I use the mapStateToProps, I get the state in the props and I can use it anywhere without any issues...

What are the benefits of using the hook besides saving lines of code compared to mapStateToProps?



from Should I use useselector instead of mapStateToProps

No comments:

Post a Comment