https://matthewdaly.co.uk/blog/2022/12/11/what-i-think-chatgpt-means-for-developers/Published by at 11th December 2022 7:20 pm Naturally I decided to have a tinker with it as I was curious about it, and I've found it very useful for coding.

Here is an example of how you might do this: 1import React, { useState, useEffect } from 'react'; 2 3function useToast() { 4 const [toasts, setToasts] = useState([]); 5 6 function showToast(msg, type) { 7 setToasts(prevToasts => [...prevToasts, { msg, type }]); 8 }

35 ); 36 return () => timeoutIds.forEach(clearTimeout); 37 }, [toasts]); 38 39 return { 40 toasts, 41 showToast: (msg: string, type: string) => 42 dispatch({ type: 'SHOW_TOAST', payload: { msg, type }}), 43 hideToast: (index: number) => 44 dispatch({ type: 'HIDE_TOAST', payload: index }) 45 }; 46} 48function App() { 49 const { toasts, showToast, hideToast } = useToast(); 50 51 return ( 53 {toasts.map((toast, index) => (
Newsletter

Get the latest Laravel/PHP jobs, events and curated articles straight to your inbox, once a week

Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge. Glimpse streamlines Laravel development by seamlessly deploying GitHub pull requests to preview environments with the help of Laravel Forge.
Fathom Analytics | Fast, simple and privacy-focused website analytics. Fathom Analytics | Fast, simple and privacy-focused website analytics.
Shirts painstakingly handcrafted by under-caffeinated developers. Shirts painstakingly handcrafted by under-caffeinated developers.
Community Partners