Spaces:
Runtime error
Runtime error
fix try it now btn
Browse files
components/input-generation.tsx
CHANGED
@@ -1,6 +1,7 @@
|
|
1 |
import classNames from "classnames";
|
2 |
import { useRef, useState } from "react";
|
3 |
import { HiLightBulb, HiSearch } from "react-icons/hi";
|
|
|
4 |
|
5 |
interface Props {
|
6 |
prompt: string;
|
@@ -18,6 +19,8 @@ export const InputGeneration: React.FC<Props> = ({
|
|
18 |
const [value, setValue] = useState<string>(prompt);
|
19 |
const input = useRef<HTMLInputElement>(null);
|
20 |
|
|
|
|
|
21 |
return (
|
22 |
<div
|
23 |
className="bg-white rounded-full p-3 w-full max-w-3xl flex items-center justify-between group transition-all duration-200 focus-within:ring-[6px] focus-within:ring-primary border-[2px] border-white focus-within:ring-opacity-40 focus-within:border-primary gap-3"
|
|
|
1 |
import classNames from "classnames";
|
2 |
import { useRef, useState } from "react";
|
3 |
import { HiLightBulb, HiSearch } from "react-icons/hi";
|
4 |
+
import { useUpdateEffect } from "react-use";
|
5 |
|
6 |
interface Props {
|
7 |
prompt: string;
|
|
|
19 |
const [value, setValue] = useState<string>(prompt);
|
20 |
const input = useRef<HTMLInputElement>(null);
|
21 |
|
22 |
+
useUpdateEffect(() => setValue(prompt), [prompt]);
|
23 |
+
|
24 |
return (
|
25 |
<div
|
26 |
className="bg-white rounded-full p-3 w-full max-w-3xl flex items-center justify-between group transition-all duration-200 focus-within:ring-[6px] focus-within:ring-primary border-[2px] border-white focus-within:ring-opacity-40 focus-within:border-primary gap-3"
|