title: Error: Too many re-renders. React limits the number of renders to prevent an infinite loop with my useState in nextjs
body: <p>I need to change the state and use it but isn't possible and i don't now whhy !!!!</p>
  <pre><code>    const [valid, setValid] = useState(false)
  
      let emailsApplied = []
  
      candidatures.map(c =&gt; {
          emailsApplied.push(c.email)
      })
  
  
      let emailSession = ''
  
      if(session){
          emailSession = session.email
      }
  
      if(emailsApplied.includes(emailSession)) {
          setValid(true)
      }
  </code></pre>