Skip to content

Commit

Permalink
Fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
Vladimir-Urik committed Apr 1, 2024
1 parent 9e610f0 commit 3324269
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/components/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,15 @@ function App() {
const [category, setCategory] = useState<'funny' | 'sexistic'>('funny')
const [text, setText] = useState('')

const getRandomText = () => {
const getRandomTextWithCategory = (category: 'funny' | 'sexistic') => {
const texts = data[category][truth ? 'truth' : 'dare']
return texts[Math.floor(Math.random() * texts.length)]
}

const getRandomText = () => {
return getRandomTextWithCategory(category)
}

useEffect(() => {
setText(getRandomText())
}, [])
Expand All @@ -47,7 +51,7 @@ function App() {

setCategory(category)
setGradient(getRandomGradient())
setText(getRandomText())
setText(getRandomTextWithCategory(category))
}

return (
Expand Down

0 comments on commit 3324269

Please sign in to comment.