title: Storing data into Local Storage after first fetch
body: <p>I am able to fetch data from an api. But my page keeps fetching the data from the api whenever the page loads. I tried to solve this issue using localStorage like below. </p>
  
  <p>I try to load the data stored in the localStorage but whenever the data loads, the data appears as [object Object].  How can i get the elements (patient_name,patient_phone) from the response instead of showing [object Object]. </p>
  
  <p>PS: Beginner with React</p>
  
  <p><strong>Component</strong></p>
  
  <pre><code>   componentDidMount()
  {
      let patients = localStorage.getItem('patients');
       if(patients)
      {
              this.setState({
              patientData: patients
       })         
      console.log(JSON.stringify(patients));
      }
      else
      {
          this.getPatients();
       }
  }
  
      getPatients(){
      return this.fetchPost().then(([response,json]) =&gt; {
         console.log(response);
         if(response.status === 200)
         {             
               this.setState({
               patientDetails: json.data.patient
            })
            localStorage.setItem('patients',json.data.patient)     
         }
      })
   }
  
       fetchPost(){
          const URL = 'http://domain:3000/api/';
          return fetch(URL, {method:'GET',headers:new Headers ({
             'Accept': 'application/json',
             'Content-Type': 'application/json',
           .then(response =&gt; Promise.all([response, response.json()]));
       }
  </code></pre>