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!