K
K
Kropovniczky2022-03-06 18:15:56
In contact with
Kropovniczky, 2022-03-06 18:15:56

Why does React VK MINI APP send three unnecessary requests on startup?

The code:

const Home = ({id}) => 	
  
  {
    const [clicks, setClicks] = useState("")
    var urlencoded = new URLSearchParams();
    urlencoded.append("clicks", "1");
    fetch(`/example`,{
      method: "POST",
      body: urlencoded,
      headers: {
        "Content-Type": "application/x-www-form-urlencoded"
      }
    })
    

     return (
    <>
    <Panel id="panel">
      <Div>
        <Button onClick={setClicks}>example</Button>
        <Text weight="medium" style={{marginLeft:256}}>
          qq
        </Text>
      </Div>
      </Panel>

        </>

When updating the application sends 3 unnecessary requests to the server. How to fix it? Or what is the best way to do this code?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question