ReactJS Warning: Each child in an array or iterator should have a unique "key" prop -


    var divarr = [        '<div>布吉岛啊</div>',        '<div>呵呵呵</div>',     ];     reactdom.render(        <div>{divarr}</div>,        document.getelementbyid("example")     ); 

but it's error:

warning: each child in array or iterator should have unique "key" prop. check top-level render call using . see [warning-keys][1] more information.

and don't know how insert 'key'

you need put unique key inside array div check code

var divarr = [  '<div key='1'>布吉岛啊</div>',  '<div key='2'>呵呵呵</div>', ]; reactdom.render(    <div>{divarr}</div>,    document.getelementbyid("example") ); 

Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -