score:0
hmm, can you try having videoplayer
accept a state variable from the parent to determine whether it is "playing" or not? so when you press on either videoplayer it fires a callback to the parent that changes the state to true/false and passes that back into both children simultaneously?
so essentially you have this:
render() {
const videoplayer = (<videoplayer episode={this.props.firstepisode} isplaying={this.state.isvideoplaying} />)
<view>
{videoplayer}
{videoplayer}
</view>
}
and videoplayer
would no longer have its own state, just props.
Source: stackoverflow.com
Related Query
- How in React native destroy an component instance to avoid memory leak and release underlie views objects of native code?
- React - How change state of single component when there are multiple instance of same component?
- How can I allow only a single instance of a React component to be present?
- React Native. Single instance of React component
- React - animate mount and unmount of a single component
- react native - expected a component class, got [object Object]
- Component won't render within NavigatorIOS - React Native
- Adding border only to the one side of the <Text/> component in React Native (iOS)
- React native text component using number of lines
- Testing a React component with Enzyme. Typescript can't find instance methods
- Dynamic Opacity not changing when component rerenders in react native
- How to import component in react native past two folders?
- Testing changes to React component state and spying on instance methods using enzyme
- How does useState() in React Hooks know which Component instance it is?
- Load custom native component in react native using expo kit
- Calling a Android Native UI component method from React native Js code
- How to pass in an instance variable from a React component to its HOC?
- Leaflet React get map instance in functional component
- What is the difference between React component instance property and state property?
- React Native pass function to child component as prop
- what is the correct type for a React instance of a component in typescript
- How to get the react component instance corresponding to event.target element in a click handler?
- Add style from props to existing component styles in React Native
- How to reuse the React JS component in React Native
- react native how to check if Component current show in screen
- How do I pass a Prop to a Navigation Screen Component - React Native
- React Native Test Error - Unable to find node on an unmounted component
- React native refresh component
- React Native Elements Line underneath FormInput Component
- Keyboard dismisses while typing TextInput in nested functional component React Native
More Query from same tag
- How do I fix "Expected to return a value at the end of arrow function" warning?
- Axios get request keeps hitting 404
- Use `ListBox` from `@headlessui/react` with Mobx?
- React - how to stop div onClick from changing sibling divs
- React Hooks. How to make other items(beside current one) deactivate when i click
- How to clear the value of an input field in a functional component without using state?
- Uncaught TypeError: confirm is not a function
- How to add React to an existing Electron app?
- reactjs redux, is it possible to have a state use by 2 components?
- Getting error TS17004: Cannot use JSX unless the '--jsx' flag is provided
- Responsive header when window is smaller or on mobile - be creative
- Best way to handle undefined values in ReactJS?
- how to display html file when clicks on list of links in react?
- Rendering <li></> with array.map not working: Return statement in map returning undefined
- Fetched data from ajax in component is not rendering in React
- What error type can we expect in getDerivedStateFromError()?
- Saga never transitions into next state despite yielding an action that is sent
- How to persist data search param in url in react js
- Formatting json data into table React.js
- What does JSX stand for?
- Troubles with using hook useState()
- Material-UI Autocomplete always show specified items
- How do I not allow submission for empty fields from a child component? More explanation below
- How to get city photo with google places api
- Refs Must Have Owner Warning
- Could not find react-redux context value; please ensure the component is wrapped in a <Provider> even if already wrapped in a provider
- React reset useMemo value
- Link tag not triggering onSubmit when clicking on the form's submit button
- Babelify sourceType error when used programmatically
- How can we make websites as responsive as Amazon?