import { StyleSheet, Text, View, Button, FlatList } from 'react-native'; import { StatusBar } from 'expo-status-bar'; import React, { useState } from "react"; import {setFavList } from '../redux/actions/action_setFavList'; //redux import {useDispatch, useSelector} from 'react-redux'; import {useEffect} from 'react'; export const Cardslist = [ { id: '1', title: "premier élément", }, { id: '2', title: "second élément", }, { id: '3', title: "élément", }, { id: '4', title: "barman douteux", }, { id: '10', title: "dernier élément", } ]; //@ts-ignore const Item = ({title}) => ( {title} ); //TODO // export const getFavList = () => { // //In order to use await your callback must be asynchronous using async keyword. // return async dispatch => { // //Then perform your asynchronous operations. // try { // //Have it first fetch data from our starwars url. // //const nounoursPromise = await fetch('https://iut-weather-api.azurewebsites.net/nounours'); // //Then use the json method to get json data from api/ // //const nounoursListJson = await nounoursPromise.json(); // //const nounoursList: Nounours[] = nounoursListJson.map(elt => new Nounours(elt["name"], elt["age"], elt["nbPoils"], elt["image"])); // dispatch(setFavList(Array{id,title})); // } catch (error) { // console.log('Error---------', error); // //You can dispatch to another action if you want to display an error message in the application // //dispatch(fetchDataRejected(error)) // } // } // } export default function Main(){ const [count, setCount] = useState(0); return ( Maman, J4AI UNE LISTE DE FAVORIS ! ! {count}