-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
0 additions
and
49 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,49 +0,0 @@ | ||
import { useRef } from 'react'; | ||
|
||
import { trpc, TRPCProvider } from './trpc'; | ||
|
||
export function Counter(props: React.ComponentProps<typeof CounterInteral>) { | ||
return ( | ||
<TRPCProvider> | ||
<CounterInteral {...props} /> | ||
</TRPCProvider> | ||
); | ||
} | ||
|
||
const CounterInteral = ({ counter }: { counter: number }) => { | ||
const incrementMutation = trpc.hello.increment.useMutation(); | ||
const keepOld = useRef(counter); | ||
if (incrementMutation.data) { | ||
keepOld.current = incrementMutation.data; | ||
} | ||
|
||
return ( | ||
<div> | ||
Count: {keepOld.current} | ||
<br /> | ||
<button | ||
className="rounded bg-blue-500 px-4 py-2 text-white" | ||
onClick={() => { | ||
incrementMutation.mutate(); | ||
}} | ||
> | ||
Increase count | ||
</button> | ||
<details> | ||
<summary>Reveal secret</summary> | ||
If you are a fan of Theo this would probably look crazy to you. | ||
<pre> | ||
{` | ||
// import vercel from '@astrojs/vercel/serverless'; | ||
let i = 0; | ||
export const helloRouter = createTRPCRouter({ | ||
increment: publicProcedure.mutation(async () => { | ||
return ++i; | ||
}), | ||
});`} | ||
</pre> | ||
</details> | ||
</div> | ||
); | ||
}; | ||
76de88c
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
b2b-saaskit – ./
b2b-saaskit-fogbender-oss.vercel.app
b2b-saaskit-git-main-fogbender-oss.vercel.app
b2b-saaskit.vercel.app
www.promptswithfriends.com
www.b2bsaaskit.com
promptswithfriends.com