score:-1
Answer:
In DestinationCard.tsx
<DestinationInfo DestinationInCountry= {DestinationInCountry} selected= {selected}/>
And
import Image from "next/image";
import styles from './DestionationInfo.module.scss';
export interface DestinationPlacesProps {
DestinationInCountry;
selected;
}
const DestinationInfo: React.FC<DestinationPlacesProps> = (props) => {
return(
<>
<div className={styles.card_wrapper}>
<div>
<Image
src={props.DestinationInCountry[props.selected].imageSrc}
alt="world pinoy flights - destinations"
width={400}
height={400}
/>
</div>
</div>
</>
)
}
export default DestinationInfo;
score:1
You are passing an array.
const [selected, setSlected] = useState('')
//Add an handle for button
const handler = (id) => {
setSelected(id)
setOpen(true)
}
<DestinationInfo selected ={selected}/>
score:1
DestinationInCountry
is an array. So add index to get imageSrc
src={props.DestinationInCountry[0].imageSrc}
Source: stackoverflow.com
Related Query
- how to get selected item in an array from another functional component react
- How to pass array as result from one functional component to another in React
- How to get refs from another component in React JS
- how to get a Component variable from another component but their both in the same file React
- How to access data from get request made by a React functional component to localhost server using Axios?
- How to get array item from json, React
- React How to get selected value from child component to parent component TypeScript
- In a react components, how to get latest data from state once it is changed from another component using redux?
- How to call functional component from another functionnal component in react js
- React : how to get input value from one component to make the ajax call in another component?
- How to get id from component in another component in functional components
- React/Mobx: How to pass single item from a mapped array into another component and retrieve only the item associated with the value clicked
- How to call a method of a functional react component from another functional react component?
- React get item from local storage after refresh in functional component
- How can I pass values from a functional component through a React Router Link to another functional component?
- How can I prevent my functional component from re-rendering with React memo or React hooks?
- Making an HTML string from a React component in background, how to use the string by dangerouslySetInnerHTML in another React 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
- React JS: how to properly remove an item from this.state.data where data is an array of objects
- How to get value from a react function within a react component
- How To Declare TypeScript Static Method From React Functional Component
- How to from one component set state another component in react native?
- How do I get acces to only one item from map method in react js
- How to pass data from one component to another in React or React-Redux?
- How do I create a react list component from an array of objects?
- How do I call/execute a function from another component in react native?
- How to get the selected value from a radio button group in React where there are multiple groups?
- How to export a state(user selected value) from one component to another component in React?
- I can not get the state from react router Link component using useLocation. So how can I pass it?
More Query from same tag
- React Material Tabs indicator not showing on first load
- getting values from <Field> onSubmit using React.js and redux.
- How to set a size and file type of image upload in React
- how to call UseState hook's state updater function inside a callback in react.js
- change in hook state not updating value in template literals
- ReactJS: setState on object of state
- Scroll to top when using Switch (react-router)
- How to append data to existing data object
- Property 'ref' does not exist on type 'IntrinsicAttributes & PhoneInputProps & { children?: ReactNode; }
- Uncaught Error: Shared module is not available for eager consumption in React module federation
- TSX + React: Uncaught TypeError: Cannot read property 'setState' of undefined at Menu.handleClick
- React mobile nav won't close automatically when navigating to another route
- Heroku react deploy
- setting firebase storage rule to watch for a piece of state in React Firebase
- doc.createParagraph not a function - docx
- Javascript Multi-translation website with microsoft translator API
- generate dates and add new property to array of object
- formData is not a constructor in react
- React testing library fails test when all tests run togother but get success when run individually
- Pass an Image imported to react Component via props
- State update not reflecting in custom hook
- How to pass a function as a prop into a route React js?
- How to emit multiple actions in one epic using redux-observable?
- Consuming resources from a React Admin app in another React Admin app
- How i play and pause React-gif image using ReactJS code
- Decorators problem: experimental syntax 'decorators-legacy' isn't currently enabled
- How can I render some JSX with onClick event?
- How to have right to left direction in react-bootstrap?
- Is there way to use Relay without GraphQL?
- Some styles from styled-components not applying when view with mobile device