@@ -22,11 +22,12 @@ module Item = {
22
22
<h2 className = "font-black text-4xl" > {React .string (` <${name} />` )} </h2 >
23
23
<div className = "mb-4 mt-8" > {docsElement } </div >
24
24
{React .array (
25
- children -> Belt .Array .map (( (color , (doc , child ))) => {
25
+ children -> Belt .Array .mapWithIndex (( idx , (color , (doc , child ))) => {
26
26
<div
27
27
className = {` shadow overflow-hidden border-b border-gray-200 sm:rounded-lg ${colorClass(
28
28
color,
29
- )} p-8 mb-8` }>
29
+ )} p-8 mb-8` }
30
+ key = {string_of_int (idx )}>
30
31
<div className = "mb-2" > {React .string (doc )} </div > <hr /> {child }
31
32
</div >
32
33
}),
@@ -959,9 +960,7 @@ module Categories = {
959
960
<div className = "text-ocamlorange font-black" >
960
961
{React .string (Printf .sprintf ("Foo-%d-%d" , n , m ))}
961
962
</div >
962
- | #Bar =>
963
- Js .log (a )
964
- React .string (Printf .sprintf ("Bar-%d-%d" , n , m ))
963
+ | #Bar => React .string (Printf .sprintf ("Bar-%d-%d" , n , m ))
965
964
}
966
965
}
967
966
let detailsComponent = foobar => {
@@ -1275,16 +1274,19 @@ module Categories = {
1275
1274
(
1276
1275
"CardGrid rendered with strings for each element" ,
1277
1276
{
1278
- let renderCard = React .string
1277
+ let renderCard = (idx , x ) =>
1278
+ <div key = {string_of_int (idx )}> {React .string (x )} </div >
1279
1279
let title = "Example"
1280
1280
<CardGrid cardData renderCard title />
1281
1281
},
1282
1282
),
1283
1283
(
1284
1284
"CardGrid rendered with Cards for each element" ,
1285
1285
{
1286
- let renderCard = s =>
1287
- <Card title = "<Card>" kind = {#Opaque }> {React .string (s )} </Card >
1286
+ let renderCard = (idx , s ) =>
1287
+ <div key = {string_of_int (idx )}>
1288
+ <Card title = "<Card>" kind = {#Opaque }> {React .string (s )} </Card >
1289
+ </div >
1288
1290
let title = "Example"
1289
1291
<CardGrid cardData renderCard title />
1290
1292
},
0 commit comments