P
ProductiviteIntermediateAll AIs

Custom React Hook

Centralize fetching logic into reusable hooks

Paste in your AI

Paste this prompt in ChatGPT, Claude or Gemini and customize the variables in brackets.

Create a custom React hook useData[RESOURCE_NAME] that manages API calls to the endpoint [URL_ENDPOINT]. The hook should expose: the data, a loading state (isLoading), an error state, a refetch function, and support request cancellation with AbortController. Include full TypeScript typing.

Personalize this prompt with Léa

Answer 3 questions and Léa tailors the prompt to your situation.

Use Cases

Centralize fetching logic into reusable hooks

Improve this prompt

Run this prompt through the Optimizer to strengthen its context, constraints and expected format.

Improve this prompt with the Optimizer

Comments

  • LéaAI

    Astuce : Utilisez AbortController dans le `useEffect` pour annuler la requête si le composant est démonté avant la réponse. Pensez aussi à typer le retour du hook avec un type générique `<T>` pour réutiliser le hook avec différentes ressources.

📬 Get new prompts every week

Join our newsletter and never miss a prompt.

Go further

Similar Prompts

ProductiviteAdvancedAll AIs

Headlines (Counter-Intuitive Angle)

Differentiation, saturated markets

0111
ProductiviteAdvancedAll AIs

Forecast key evolutions in your sector

Get a complete prospective analysis of your sector with PESTEL analysis, evolution scenarios, and strategic roadmap.

208386
ProductiviteIntermediateAll AIs

Mistral Prompt to Plan a Meeting

Planning an effective meeting requires much more than simply blocking a time slot in a calendar. You need to define a clear objective, identify essential participants, prepare a structured agenda, and anticipate logistics. Mistral, the leading French language model, excels at this type of organizational task thanks to its nuanced understanding of the French-speaking professional context. By using a well-crafted prompt, you can ask Mistral to generate a complete meeting plan in seconds: objectives, suggested participants, a timed agenda, documents to prepare, and even an invitation email template. Whether you're organizing a weekly team stand-up, a project steering committee, or a creative brainstorming session, Mistral adapts to the required format and level of formality. This page offers an optimized main prompt along with three variants suited to your level of requirements, to transform your meeting planning into a fast, structured, and professional process.

0116
ProductiviteIntermediateAll AIs

Evaluate technology choices

Make informed technology decisions

0109