DEV Community

Discussion on: React Beginner Question Thread ⚛

Collapse
 
srbin12 profile image
miodrag

another quest is how I can use one of all data of data.json file by field Id in this file. const some=[{ "id": 0, "name": "name one"},{ "id": 1, "name": "name 1"},{ "id": 2, "name": "name 2"},{ "id": 3, "name": "name 3"}];
If I use map method react rendered all data of file. How I can get only example data where is "id": 3? I am try use


    {
    data.map((film,i)=>{
    if(i===3) {
    return (


    {film.id} ----
    {film.title}



    );

    }

    })

    }



and getwarning Expected to return a value at the end of arrow function array-callback-return.

How make that? to be glad if you have some sample

reagrad

Miodrag Trajanovic

trajanovicmiodrag@yahoo.com