Skip to content

Instantly share code, notes, and snippets.

View buYoung's full-sized avatar

BuYoungLee buYoung

  • Korean
View GitHub Profile
@buYoung
buYoung / howToUse.tsx
Last active February 2, 2024 04:38
Custom Hook for React Router v6 Before the Addition of useBlocker
// use case useStateWithCallbackLazy for blocking Status
function Ui(props) {
const [promptStatus, setPromptStatus] = useStateWithCallbackLazy(true);
const [showPrompt, confirmNavigation, cancelNavigation] = useCallbackPrompt(promptStatus);
const handleExit = () => {
confirmNavigation();
setPromptStatus(false, () => {
navigate(pageUrl });
});
@buYoung
buYoung / http_log.go
Last active June 1, 2024 11:56
Advanced Logging in Go with Zerolog and Lumberjack
package logger
type LogRequestBodyType string
const (
LogRequestBodyTypeFormData = "multipart/form-data"
LogRequestBodyTypeJSON = "application/json"
LogRequestBodyTypeTEXT = "text/plain"
LogRequestBodyTypeURLEncoded = "application/x-www-form-urlencoded"
)