score:0
I think this is maybe a little opinion-based. Getting it from flux store means there is a hard coupling with store lib. If you pass in the prop, you can reuse the component in another, storeless, application. I've encountered this a lot with some of the components I've made and tend towards passing props in. But again, it can make sense in some cases where the component would never see reuse anyway.
score:0
This is an opinion-based question but I've always felt and have been taught if props is only affected in the child then it should be passed down instead of using redux. If the props are used many children down and to prevent prop-drilling or needs to be referenced somewhere else that isn't directly changed by the parent then use redux.
score:2
Passing data through props makes the component a functional one or at least more functional. Such components are easier to maintain, test and reuse. It also makes it less dependent on future changes in the store structure. But, as it is often in our lives, there are no things as the only one right way. If your project contains many nested components, passing data all the way down through all layers would make code entangled and complicated.
In my practice, I always make UI components (lists, edits, grids, tables, etc.) as pure functional ones and use them inside business-logic-related components which are connected to store and perform side effects.
Source: stackoverflow.com
Related Query
- Is it better to pass prop to child even if I can get it from redux inside child?
- React: Can we pass 2 forms from 2 different child components to a parent, and submit them with a button which is inside the parent component?
- How can we get pass data from child to parent in reactJS?
- In REACT.js how can I pass a state from child component up to Parent component as a prop
- Can we pass setState as props from one component to other and change parent state from child component in React?
- Pass React Ref from parent to child in order to get DOM element
- React.js how to pass in index as prop to child component from this.props array
- I can not get the state from react router Link component using useLocation. So how can I pass it?
- In React, Is it possible to get access to Redux action creators from inside a utility function?
- Pass prop from child to parent React
- React & Typescript how get onClick prop from child to parent
- How do I pass the text data from firestore inside the expandable row and get the document ID to be passed inside the setState?
- How can I pass a prop by child index in React
- How can get Value from child component in react?
- Using React Hooks, when I pass down a prop from parent to a child component, the prop in the child component is undefined
- How can i get access to the current user inside of react from firebase?
- How can i only re-render the new child component when mapping an array from Redux state?
- How to pass a prop back from child to parent in onclick handler and then to another component in React?
- Within a parent component, is there any way I can access a prop from a child component?
- React Redux state array variable pass as prop to child component, either infinite loop or empty array
- How can I get more than one value from the Redux store in a single statement?
- Can I pass setState from parent to child component?
- Enzyme - how to get an instance of a function from a container, to pass as a prop to a component?
- React Redux: How to pass specific object prop from store to child component?
- How can I get all sibling components to correctly re-render when dispatching a redux action from one sibling component?
- How can I pass image url from parent component to child component via props [REACT.JS]
- How can I pass props from a Parent to Child with this.props.children?
- How can i pass the data from the response as a prop to a component?
- Able to get the updated state from redux store but not able to access the objects inside the updated state from the receiver component
- How a child component can get several props/data from two separate parent components
More Query from same tag
- How to keep only one radio button selected with React
- PayPal responding with "CANNOT_MIX_CURRENCIES" when purchase unit currency changed
- Symfony and React - Syntax Error: Unexpected token, expected ";"
- How to show a div on input focus with CSS?
- Is there a way to pass a generic type to the reducer used in react useReducer hook?
- useEffect not re-rendering when expected
- Javascript ReactJs Put JsCss and Component in external files
- Calling Multiple component in same page in React.js
- How to change only a part of a state?
- Where are lifecycle methods defined in React's source code?
- How to check for object properties in a conditional statement in JavaScript?
- Display Search Results from API React/Redux
- React Component and constructor bind not working
- Reactjs problem rendering binary image retrieved from mongodb
- In React with Redux, why routerReducer is needed
- How to display HTML received in JSON using React
- Redux-Saga is not waiting for action to complete using redux-saga-firebase
- React this.setState doesnt rerender content
- How to add constant inside Joi validator?
- Unstated Cannot read property 'setState' of undefined
- React Router- link doesn't replace the url
- Passing functions into other components in React
- react updating state in an array inside of an object which is inside of another array
- How can I pass React props in audio player?
- ReactJS Axios, the web api is called more then once
- How to recursively export all from folders in node js project?
- How to validate react input fields with some custom validation
- Submit formsdata into a table in ReactJS
- Monitoring multiple server stats in React JS
- renderProps undefined in Server side/Isomorphic Rendering for React/React-Router + Node/Express.js