docs/_snippets/tanstack-react-query-and-path.md
import type { Meta, StoryObj } from '@storybook/tanstack-react';
import { Route } from './Page';
const meta = {
parameters: {
tanstack: {
router: {
route: Route,
},
},
},
} satisfies Meta<typeof Route>;
export default meta;
type Story = StoryObj<typeof meta>;
export const WithHash: Story = {
parameters: {
tanstack: {
// ๐ Provide the URL fragment (hash) for the route
router: { path: '/#section-name' },
},
},
};
export const WithSearch: Story = {
parameters: {
tanstack: {
// ๐ Provide the query string for the route
router: { query: { tab: 'details', page: '2' } },
},
},
};
import preview from '../.storybook/preview';
import { Route } from './Page';
const meta = preview.meta({
parameters: {
tanstack: {
router: {
route: Route,
},
},
},
});
export const WithHash = meta.story({
parameters: {
tanstack: {
// ๐ Provide the URL fragment (hash) for the route
router: { path: '/#section-name' },
},
},
});
export const WithSearch = meta.story({
parameters: {
tanstack: {
// ๐ Provide the query string for the route
router: { query: { tab: 'details', page: '2' } },
},
},
});