React react-select / Each child in a list should have a unique "key" prop

I use react-select I get nex warning from react Warning: Each child in a list should have a unique "key" prop. My component: import React from "react"; import Select from "react-select"; import styles from "./Filter.module.scss"; interface SearchBarProps { setParametr: React.Dispatch<React.SetStateAction<string>>; data: Array<{ name: string; value: number }>; placeholder: string; } export const SearchBar: React.FC<SearchBarProps> =… Read More React react-select / Each child in a list should have a unique "key" prop

React-select how to render only option values that are not undefined

I need to render my Option values based on if/else that will show only option related to parameter from query const renderLsit = useMemo(() => { return mediaCategories?.Entities?.map((category, _) => { if ( category.CategoryTypeCode === MediaCategoryType.Other && params.type === "categories" ) { return { value: category.CategoryId, label: category.CategoryName, index: category.CategoryId, }; } else if (… Read More React-select how to render only option values that are not undefined

REACT-SELECT defaultValue in CustomDropdown not working

I want the default value of my dropdown to be defaultValue={item.taste} (value from match.json) but it’s not working… (go to /menu/Menu1 and Pea Soup) import Select from "react-select"; export default function CustomDropdown({ style, options, defaultValue }) { return ( <div style={style}> <Select options={options} defaultValue={defaultValue} /> </div> ); } MenuItemDisplay: export default function MenuItemDisplay() { const… Read More REACT-SELECT defaultValue in CustomDropdown not working

How to set api json data to react-select default value

I want to set API JSON data to react-select default values const [tag, setTag] = useState([]) const [tag_data, setTagData] = useState([[]]); useEffect function for call API and get the JSON data useEffect(() => { (async () => { const tag_result = await axios(`${process.env.REACT_APP_API_URL}/tag`); setTagData(tag_result.data); })(); }, []); Below is my API JSON data response {id:… Read More How to set api json data to react-select default value