title: How to use let from another component in the main React App?
body: <p>I am react beginner and I would like to use my formIsValid let from component in the main App.js. So when it is false DeliveryNote component should be visible, but when it changes to true it hides and shows LoadProducts component</p>
  <p>The problem is I can't transfer states to another component I know you can use redux or context for it, but I am not pretty sure how</p>
  <pre><code>  const deliveryNoteInputRef = useRef();
  
    const formSubmissionHandler = (event) =&gt; {
      event.preventDefault();
      const enteredDeliveryNote = deliveryNoteInputRef.current.value;
  
      const enteredDeliveryNoteisValid = enteredDeliveryNote.trim() === &quot;1234&quot;;
  
      let formIsValid = false;
  
      if (enteredDeliveryNoteisValid) {
        formIsValid = true;
        console.log(formIsValid);
      }
  
      if (!enteredDeliveryNoteisValid) {
        console.log(formIsValid);
        return;
      }
      console.log(enteredDeliveryNote);
    };
    return (
      &lt;Card className=&quot;login&quot;&gt;
        &lt;form onSubmit={formSubmissionHandler}&gt;
          &lt;div className=&quot;control&quot;&gt;
            &lt;label htmlFor=&quot;delivery_note&quot;&gt;Load ID&lt;/label&gt;
            &lt;input type=&quot;text&quot; id=&quot;delivery_note&quot; ref={deliveryNoteInputRef} /&gt;
          &lt;/div&gt;
          &lt;div className=&quot;actions&quot;&gt;
            &lt;button className=&quot;button&quot;&gt;Potvrdit&lt;/button&gt;
          &lt;/div&gt;
        &lt;/form&gt;
      &lt;/Card&gt;
    );
  };
  
  </code></pre>