using WordPress's apiFetch with react returns same value every time

so I have select and content container, when select changes there goes apiFetch with selected ID to get data from post with that ID, props.attributes.theId changes correctly but response from every apiFetch is just one last post every time, what could be the problem? const [thePreview, setThePreview] = useState("") useEffect(() => { async function go() { alert(props.attributes.theId); const response = await apiFetch({ path: `/thePlugin/v1/getHTML?theId=${props.attributes.theId}`, method: "GET" }) setThePreview(response) } go() }, [props.attributes.theId])

Comment (0)

You’ll be in good company