Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

render method of `AnalogClock`

$
0
0

my app is running successfully but it indicates that warning

ERROR Warning: Each child in a list should have a unique "key" prop.

Check the render method of AnalogClock.

const renderClock = () => {

    if (clockType === 'analog') {        return (<AnalogClock                key={selectedTimeZone} // Unique key for each instance of AnalogClock                colorClock={                    timeZones.find(                        (zone) =>                            zone.value ===                            selectedTimeZone).color                }                colorNumber="#000000"                colorCenter="#00BCD4"                colorHour="#FF8F00"                colorMinutes="#FFC400"                hour={time.setZone(selectedTimeZone).hour}                minutes={time.setZone(selectedTimeZone).minute}                seconds={time.setZone(selectedTimeZone).second}                autostart={true}                showSeconds={true}            />        );    } else {        return (<Text style={                [styles.digitalClock,                {                    color:                        timeZones.find(                            (zone) =>                                zone.value ===                                selectedTimeZone).color                }]}>                {getTimeInTimeZone(selectedTimeZone)}</Text>        );    }};

How would I resolve this error? how would I change the key value that should be unique?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>