score:1
Accepted answer
you passed down the root-component's player-state as a property to home
. so you have to access it from props
.
just update your home
component to the following:
class home extends component {
render(){
return (
<div classname="add-players">
<players players={this.props.players}/>
<div classname="add-player"></div>
<button classname="start-btn">
<i classname="material-icons">play_arrow</i> <p>let's play!</p>
</button>
</div>
);
}
}
export default home;
Source: stackoverflow.com
Related Query
- How to set defaultChecked getting value from state React Functional Component Checkbox (React - Hooks)
- React - state not getting updated after a prop being sent from another component
- Getting state from root component - react.js
- React - Getting collection from Firebase and updating state to render a child component
- React state is getting overwritten when coming back from child component
- React component initialize state from props
- React js change child component's state from parent component
- React - getting a component from a DOM element for debugging
- Update component state from outside React (on server response)
- Set React component state from outside of component
- How to set React component state and props from browser
- Change react hook state from parent component
- How to initialize the react functional component state from props
- How to update the state of a sibling component from another sibling or imported component in REACT
- Updating Parent Component State from Child Component with UseState React Hook
- React Apollo: Dynamically update GraphQL query from Component state
- How to maintain react component state when goback from router?
- Reactjs getting a state value from a child component
- how and when to call a react component methods after state change from redux
- How do I sync state from the DOM to my React Component in an Isomorphic Application?
- React: How to add onChange functionality inside of Function component using React Hooks? Need onClick event from a checkbox to influence input state
- React multiple instances of same component are getting same state
- Update a react state (array of objects) from a child component
- Trigger state change of a React component from Chrome extension on a Facebook post
- How to from one component set state another component in react native?
- How do I manage state on a React component that can have state changed from the parent or from events upon it?
- Sharing state from parent to child component in React
- what is proper way to import multiple components from same file in react instead of getting each component imported
- Getting the ref from a dynamic component when using Redux, React and react-router-dom 4.x
- Change state of React component from old external Javascript?
More Query from same tag
- How to apply Break lines in React Modal?
- Header background image disappear and fade away on scroll with bottom gradient in React app
- React: Render children only if condition is true
- Reactjs Typescript form input elements value not working
- How to make path for pages in NextJS case insensitive
- TSX + React: Uncaught TypeError: Cannot read property 'setState' of undefined at Menu.handleClick
- is is possible to have multiple layouts in Gatsby
- ''Access-Control-Allow-Origin' header is present on the requested resource
- VoiceOver Cursor vs Keyboard Focus
- es lint '' is assigned a value but never used' eventhough i have used it
- How to pass state and props from app.js to other files?
- How to get current user to display profile page in React app?
- Need Reactjs help on how to properly pass this function from the parent to child button component
- How to use map function with react router?
- React - Dynamic form fields where fields change based on a dropdown menu (using hooks)
- Returning Null When Fetching API Asynchronously Before Data Fetches
- Where to Put Code that should run First ReactJs + Mobx State Tree
- React inline css placing brackets directly in html output
- React - Decorating Children and Handling Keys
- Set multiple (interdependent) values on state at the same time
- how to use OnLoad to show loader when image is loading in react.js
- Updating state value of a function that is called inside render method
- Component rendering before ComponentDidMount and Axios sets the state
- Next step in form does not render
- Typescript error type not assign able to state - usestate
- Can a String be used as a value in series of Echarts
- Yotpo reviews and galleries not loading on page change
- Dynamically Set header for all requests ( React, super-agent )
- Cannot read property 'contains' of null
- Getting error Too many re-renders when using useState to assign match.params value to it