title: How to reload a component or call a function after action in another component with React Native
body: <p>I use <strong>React Native</strong> and <strong>Expo</strong> to develop an application on mobile and tablet.</p>
  <p>The objective is to be able to answer a questionnaire where several questions are divided into various categories. A question may have a category or not, so they don't really follow each other in the code.</p>
  <p>I use a loop to display my categories, with its questions inside. Questions are components, categories too.</p>
  <p>When I answer a question, sometimes I want to reload another question specifically (or several). After answering my question, I have a list of questions I want to reload.
  I would like either to <strong>launch a function</strong> in the component, or to <strong>reload it entirely</strong>.</p>
  <p>How do I <strong>reload the question component</strong>, which may be quite far from the one I acted on?</p>
  <p>Thanks for your help !</p>
  <p>I wanted to listen with UseEffect for the modification of my global variable, but it doesn't work. Also, I can't fully reload my page either. I would like to <strong>specifically reload the question component</strong> or <strong>run the function</strong>.</p>
  <p>What I have already tried:</p>
  <ul>
  <li><p>Reloading the page entirely from my screen with a function in global, didn't work (
  I have a lot of elements so I would like to avoid reloading everything)</p>
  </li>
  <li><p>Listen with useEffect the change of my list of questions to modify to check if my id was in it, but the listening is not done</p>
  </li>
  <li><p>I can't send functions or other elements in the props of my question because they can be in different components (category or other) so too far away.</p>
  </li>
  </ul>
  <p>Question Component (simplified) :</p>
  <pre><code>export default function RealisationQuestionComponent(props){
  
  //When action in Question A
  function changeCheckA(value) {
     [...]
     if (props.question.questions_impactees !== undefined) {
        global.questions_impactees = props.question.questions_impactees;
     }
  }
  
  //Effect in Question B
  useEffect(() =&gt; {
     [my function or reload entire component]
  }, [global.questions_impactees]);
  
  
  return (
     &lt;&gt;...&lt;/&gt;
  )
  </code></pre>
  <p><strong>EDIT :</strong></p>
  <p>Following the answer, I tried to use <strong>useContext</strong> to retrieve my information, but it tells me <em>Can't find variable : RealContext</em></p>
  <p>What i would like to do :</p>
  <p><a href="https://www.w3schools.com/react/showreact.asp?filename=demo2_react_context2" rel="nofollow noreferrer">https://www.w3schools.com/react/showreact.asp?filename=demo2_react_context2</a></p>
  <p>What I have done :</p>
  <p><em>My screen AuditRealisationScreen</em></p>
  <pre><code>const RealContext = createContext();
  const [listIdVictimes, setListIdVictimes] = useState('please test');
  [...]
  return (
      &lt;RealContext.Provider value={listIdVictimes}&gt;
          &lt;RealisationChapitreComponent/&gt;
      &lt;/RealContext.Provider&gt;
  )
  </code></pre>
  <p>RealisationChapitreComponent &gt; [...] &gt; RealisationQuestionComponent</p>
  <p><em>In my component RealisationQuestionComponent</em></p>
  <pre><code>const listTest = useContext(RealContext);
  [...]
  return (
      &lt;Text&gt; {listTest} &lt;/Text&gt;
  )
  </code></pre>
  <p>Can it work this way?</p>