Company logo
  • Empleos
  • Bootcamp
  • Acerca de nosotros
  • Para profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
    • Bootcamp
  • Para empresas
    • Inicio
    • Nuestro proceso
    • Planes
    • Pruebas
    • Nómina
    • Blog
    • Comercial
    • Calculadora

0

53
Vistas
Why is mapStateToProps needed if I can use the entire store in my component?

From definition

mapStateToProps is used for selecting the part of the data from the store that the connected component needs.

I didn't understand why do we even have to specify mapStateToProps if I can use the entire store data in my component, what exactly does mapStateToProps provides? What will happen if I select some part of data?

Any advantages?

7 months ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

  • mapStateToProps gives you only the parts of the store you need in the component.
  • It calls every time the store state changes (every time the relative part of the store that you return is changed).
  • It can return different structures of the store data
  • Can return different structures of the store data for different component props.
  • Can be re-used for different components that need the same parts of the store
7 months ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos