I am using React native andI have a loop in which some property types are being displayed,
i created only one state for it because property types are being fetched from DB.What i want to do is to show them selected. kindly show me a way to achieve it.
const [propBCol, setPropBCol] = useState('#EDEDEE'); const [propTCol, setPropTCol] = useState('#000000'); {propType.map((item, index) => { return ( <TouchableOpacity style={{ backgroundColor: propBCol, ...ListingFilterStyles.filterAnyBtn, ...ListingFilterStyles.btnMale, }} onPress={() => proptypes(item)}><Text style={{color: propTCol}}>{item.value}</Text></TouchableOpacity> ); })}
the propTypes function:
const proptypes = item => { setPropBCol('red'); setPropTCol('White')}
enter code here
How can i change the selected item color, by above code all are item colors are being changed