Skip to content

Commit

Permalink
feat: quote generator, prettier ran. (#685)
Browse files Browse the repository at this point in the history
  • Loading branch information
UzairNoman authored Oct 6, 2023
1 parent 9670773 commit d06fc88
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions packages/kitchen-sink/src/examples/quote-generator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import React, { useState } from 'react';
import { block } from 'million/react';

const QuoteGenerator: React.FC = block(() => {
const [quote, setQuote] = useState<string>('');

const fetchNewQuote = () => {
fetch('https://api.quotable.io/random')
.then((response) => response.json())
.then((data) => {
if (data.content) {
setQuote(data.content);
}
})
.catch((error) => console.error('Error fetching quotes:', error));
};

return (
<div>
<h1>Inspirational Quote Generator</h1>
<button onClick={fetchNewQuote}>Get New Quote</button>
<p>{quote}</p>
</div>
);
});

export default QuoteGenerator;

2 comments on commit d06fc88

@vercel
Copy link

@vercel vercel bot commented on d06fc88 Oct 6, 2023

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:

million-kitchen-sink – ./packages/kitchen-sink

million-kitchen-sink-git-main-millionjs.vercel.app
million-kitchen-sink.vercel.app
million-kitchen-sink-millionjs.vercel.app

@vercel
Copy link

@vercel vercel bot commented on d06fc88 Oct 6, 2023

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:

sink – ./packages/kitchen-sink

sink-git-main-millionjs.vercel.app
sink-millionjs.vercel.app
million-kitchen-sink-atit.vercel.app
sink.million.dev

Please # to comment.