mirror of
https://github.com/jakejarvis/jarv.is.git
synced 2025-04-27 08:58:30 -04:00
fix component effects
This commit is contained in:
parent
65d413ca8c
commit
7fbdf16573
@ -10,7 +10,7 @@ const Counter = (props) => {
|
||||
|
||||
// start fetching hits from API once slug is set
|
||||
useEffect(() => {
|
||||
return fetch(`/api/hits/?slug=${encodeURIComponent(props.slug)}`)
|
||||
fetch(`/api/hits/?slug=${encodeURIComponent(props.slug)}`)
|
||||
.then((response) => response.json())
|
||||
.then((data) => setHits(data.hits || 0));
|
||||
}, [props.slug]);
|
||||
|
@ -12,7 +12,7 @@ const RepositoryGrid = () => {
|
||||
// start fetching repos from API immediately
|
||||
useEffect(() => {
|
||||
// API endpoint (sort by stars, limit to 12)
|
||||
return fetch("/api/projects/?top&limit=12")
|
||||
fetch("/api/projects/?top&limit=12")
|
||||
.then((response) => response.json())
|
||||
.then((data) => setRepos(data || []));
|
||||
}, []);
|
||||
|
@ -11,7 +11,7 @@ const ThemeToggle = () => {
|
||||
const [dark, setDark] = useState(isDark());
|
||||
const [saved, setSaved] = useState(!!getDarkPref());
|
||||
|
||||
// real-time switching between modes based on system if preference isn't set (and it's supported by OS/browser)
|
||||
// real-time switching between modes based on user's system if preference isn't set (and it's supported by OS/browser)
|
||||
const matchCallback = useCallback((e) => setDark(e.matches), []);
|
||||
useEffect(() => {
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user