image

Unlimited bootcamps + English course forever

80
%OFF
Article image
Vener Silveira
Vener Silveira18/06/2022 10:15
Share
WEX - End to End EngineeringRecommended for youWEX - End to End Engineering

React Native vetor externado em um json

    Olá pessoal,

    Ainda em referência ao desafio do prof. Ismael Moreira externei os vetores das mensagens para um arquivo .json.

    [

      {

       "array":[

         [0,0,0,0,0,0,0,0,0,0,0,0,0],

         [0,1,1,0,0,0,1,0,0,0,1,0,0],

         [0,1,0,1,0,0,1,0,0,1,0,1,0],

         [0,1,0,1,0,0,1,0,0,1,0,1,0],

         [0,1,1,0,0,0,1,0,0,0,1,0,0],

         [0,0,0,0,0,0,0,0,0,0,0,0,0]

       ],

       "description":"dio"

      ,....

    e consumi no App.js assim:

    import dataMap from './src/dataMap.json';

    const map=[];

    for(let key in dataMap){

      map.push(dataMap[key].array);

    }

    https://github.com/venerfruet/modulo_iv_reactive_native/tree/main/projects/desafio_isma

    Desta maneira separei os dados do código.

    Valeu!

    Share
    Recommended for you
    WEX - End to End Engineering
    Microsoft 50 Anos - Prompts Inteligentes
    Microsoft 50 Anos - GitHub Copilot
    Comments (0)
    Recommended for youWEX - End to End Engineering