We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
const Pokemon = () => { const [pokemon, setPokemon] = useState(null); const loadPokemon = (url) => setPokemon(url); const { data, error } = useSWR('https://pokeapi.co/api/v2/pokemon', fetch); const { pokemonData, pokemonError } = useSWR(pokemon, fetch); // This is null console.log(pokemonData, pokemonError) if (error) return <div>failed to load</div> if (!data) return <div>loading...</div> return <div>{data.results.map(pokemon => { return <h2 key={pokemon.name} onClick={() => loadPokemon(pokemon.url)}>{pokemon.name}</h2> })} </div> }
Don't know what I am doing wrong. But the second useSWR is always undefined, even though I see the network calls going through.
The text was updated successfully, but these errors were encountered:
Hello, please try this
const { data: pokemonData, error: pokemonError} = ...
Sorry, something went wrong.
That works thank you so much
No branches or pull requests
Don't know what I am doing wrong. But the second useSWR is always undefined, even though I see the network calls going through.
The text was updated successfully, but these errors were encountered: