fix controller/uncontrolled react warning error

This commit is contained in:
Dobromir Popov
2024-04-06 18:25:46 +03:00
parent 16ffe5fe8f
commit 239207e1d3

View File

@ -4,8 +4,7 @@ import toast from "react-hot-toast";
import { useRouter } from "next/router"; import { useRouter } from "next/router";
const PublisherInlineForm = ({ publisherId, initialShiftsPerMonth }) => { const PublisherInlineForm = ({ publisherId, initialShiftsPerMonth }) => {
const [desiredShiftsPerMonth, setDesiredShiftsPerMonth] = useState(initialShiftsPerMonth); const [desiredShiftsPerMonth, setDesiredShiftsPerMonth] = useState(initialShiftsPerMonth || 2);
const router = useRouter();
const storedValue = useRef(initialShiftsPerMonth); const storedValue = useRef(initialShiftsPerMonth);
useEffect(() => { useEffect(() => {