This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { useLocation, useLoaderData, useFetcher } from "remix" | |
export default function useLoaderDataWithWindowFocusRefetching<LoaderData>() { | |
const loaderData = useLoaderData<LoaderData>() | |
const fetcher = useFetcher<LoaderData>() | |
const location = useLocation() | |
const pathnameRef = React.useRef(location.pathname) | |
React.useEffect(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from "react" | |
import { useLocation, useNavigate } from "remix" | |
export default function useWindowFocusRefetching() { | |
const location = useLocation() | |
const navigate = useNavigate() | |
const pathnameRef = React.useRef(location.pathname) | |
React.useEffect(() => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// add to your tailwind.config.js | |
const plugin = require("tailwindcss/plugin") | |
const radixPlugin = plugin(({ addVariant }) => { | |
const dataStates = [ | |
"open", | |
"closed", | |
"active", | |
"inactive", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: "booking", | |
context: { | |
newsletterIndex: null, | |
placementId: null, | |
availabilityId: null, | |
reservationId: null | |
}, | |
type: "parallel", | |
states: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: "booking", | |
context: { | |
newsletterIndex: null, | |
placementId: null, | |
availabilityId: null, | |
}, | |
type: "parallel", | |
states: { | |
booking: { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'booking', | |
context: { | |
placementId: null, | |
availabilityId: null | |
}, | |
initial: 'step1', | |
states: { | |
step1: { | |
entry: "releaseReservation", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'app', | |
context: {}, | |
initial: 'workouts', | |
states: { | |
workouts: { | |
on: { | |
NEW_WORKOUT: { | |
target: "newWorkout" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Available variables: | |
// - Machine | |
// - interpret | |
// - assign | |
// - send | |
// - sendParent | |
// - spawn | |
// - raise | |
// - actions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'session', | |
initial: 'restoring', | |
states: { | |
restoring: { | |
initial: "loading", | |
states: { | |
loading: { | |
invoke: { | |
src: "restore", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Machine({ | |
id: 'collections', | |
initial: 'fetching', | |
states: { | |
fetching: { | |
invoke: { | |
src: "fetchCollections", | |
onDone: "success", | |
onError: "failure" | |
} |
NewerOlder