This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useEffect } from 'react'; | |
import Welcome from '../Components/Welcome'; | |
import ExcerciseList from '../Components/ExcerciseList'; | |
import AddButton from '../Components/AddButton'; | |
const Exercises = props => { | |
const [state, setState] = useState({ | |
data: [] | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//this code snippet solve the problem with frontend refresh when you write the cache with PostForm: | |
//in Home.js use this: | |
const [posts, setPosts] = useState([]); | |
const { user } = useContext(AuthContext); | |
const { loading, data } = useQuery(FETCH_POSTS_QUERY); | |
useEffect(() => { | |
if (data) { | |
setPosts(data.getPosts); | |
} |