In my React application I need to grep the url
with "type": "Three"
?
How to find and return only specific key value based on another key value with Javascript?
From the api I get an array of images:
"images": [
{
"url": "https:example/c18336d6-61ee-4c7c-be6b-397352b6fd63",
"type": "One"
},
{
"url": "https://example/c18336d6-61ee-4c7c-be6b-397352b6fd63",
"type": "Two"
},
{
"url": "https://example/c18336d6-61ee-4c7c-be6b-397352b6fd63",
"type": "Three"
},
]
},
Then in my React component I want to use this value:
const MyComponent = () => {
const items =
nodes.map((item) => {
return {
myImage: // Here I need e.g. the url value of the images array with type = Three.
};
}) || [];
return <Slides items={items} />
export default MyComponent;