title: JSON Parse error: Unexpected EOF occurred when trying to change value
body: <p>I am using NodeJS express as backend and mongo atlas in my react-native-expo app. I have stored data in my TicketScreen.js but when I try to change value in data in AllTicketScreen.js error occurs.</p>
  <p>Can anyone tell why I am not able to change value in my AllTicketScreen.js and how can I do that ?</p>
  <p><strong>TicketScreen.js</strong></p>
  <pre><code>handleSubmit = () =&gt; {
          fetch(&quot;http://d5c2ae1dd6ff.ngrok.io/send-data&quot;, {
              method: &quot;POST&quot;,
              headers: {
                  'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                  name: name,
                  request: request,
                  subject: subject,
                  category: category,
                  priority: priority,
                  desc: desc,
                  location: location,
                  status: &quot;Open&quot;
              })
          })
          .then(res =&gt; res.json())
          .then(data =&gt; {
              navigation.navigate(&quot;Home&quot;)
          })
      }
  </code></pre>
  <p><strong>AllTicketScreen.js</strong></p>
  <pre><code>useEffect(() =&gt; {
          readData()
      }, [])
  
      onRefresh = () =&gt; {
          setRefreshing(true);
          readData();
      }
  
      readData = () =&gt; {
          fetch(&quot;http://d5c2ae1dd6ff.ngrok.io/&quot;)
              .then(res =&gt; res.json())
              .then(results =&gt; {
                  setData(results)
                  setRefreshing(false)
              })
              .catch((error) =&gt; {
                  console.error(error);
              });
      }
  
      ticketClosed = () =&gt; {
          fetch(&quot;http://d5c2ae1dd6ff.ngrok.io/closed&quot;, {
              method: &quot;POST&quot;,
              headers: {
                  'Content-Type': 'application/json'
              },
              body: JSON.stringify({
                  id: data._id,
                  name: data.name,
                  request: data.request,
                  subject: data.subject,
                  category: data.category,
                  priority: data.priority,
                  desc: data.desc,
                  location: data.location,
                  status: &quot;Closed&quot;
              })
          })
          .then(res =&gt; res.json())
          .then(data =&gt; {
              navigation.navigate(&quot;Home&quot;)
          })
          .catch(err =&gt; {
              console.log(&quot;Error occurred: &quot; + err);
          })
      }
  
  &lt;ScrollView refreshControl={
                  &lt;RefreshControl
                      refreshing={refreshing}
                      onRefresh={onRefresh}
                  /&gt;
              }&gt;
                  &lt;View&gt;
                      {data.length &gt; 0 &amp;&amp; (
                          &lt;List.AccordionGroup&gt;
                              {
                                  data.map((rowData, index) =&gt; (
  
                                      &lt;List.Accordion title={rowData.subject} key={rowData._id} id={rowData._id} style={{ marginBottom: 10, backgroundColor: 'white', marginTop: 10, }}&gt;
                                          &lt;View style={{ padding: 20, backgroundColor: '#FAFAFA' }}&gt;
                                              &lt;Text style={styles.ticketDescription}&gt; Project Name:  &lt;/Text&gt;&lt;List.Item title={rowData.name} /&gt;
                                              &lt;Text style={styles.ticketDescription}&gt; Requested By:  &lt;/Text&gt;&lt;List.Item title={rowData.request} /&gt;
                                              &lt;Text style={styles.ticketDescription}&gt; Category:  &lt;/Text&gt;&lt;List.Item title={rowData.category} /&gt;
                                              &lt;Text style={styles.ticketDescription}&gt; Priority:  &lt;/Text&gt;&lt;List.Item title={rowData.priority} /&gt;
                                              &lt;Text style={styles.ticketDescription}&gt; Location:  &lt;/Text&gt;&lt;List.Item title={rowData.location} /&gt;
                                              &lt;Text style={styles.ticketDescription}&gt; Description:  &lt;/Text&gt;&lt;List.Item title={rowData.desc} /&gt;
                                              &lt;View&gt;
                                                  &lt;View&gt;
                                                      &lt;Text style={styles.ticketDescription}&gt; The Ticket is :  &lt;/Text&gt;
                                                  &lt;/View&gt;
                                                  &lt;View&gt;
                                                      &lt;List.Item title={rowData.status} /&gt;
                                                  &lt;/View&gt;
                                              &lt;/View&gt;
                                              &lt;View style={{ flexDirection: 'row', justifyContent: 'space-between', marginLeft: 30, marginRight: 30 }}&gt;
                                                  &lt;View style={styles.closedButtonBox}&gt;
                                                      &lt;TouchableOpacity onPress={() =&gt; ticketClosed()}&gt;
                                                          &lt;Text style={styles.closedButton}&gt; Closed &lt;/Text&gt;
                                                      &lt;/TouchableOpacity&gt;
                                                  &lt;/View&gt;
                                                  &lt;View style={styles.closedButtonBox}&gt;
                                                      &lt;TouchableOpacity onPress={() =&gt; console.log(&quot;Pressed Resolved&quot;)}&gt;
                                                          &lt;Text style={styles.closedButton}&gt; Resolved &lt;/Text&gt;
                                                      &lt;/TouchableOpacity&gt;
                                                  &lt;/View&gt;
                                              &lt;/View&gt;
  
                                          &lt;/View&gt;
                                      &lt;/List.Accordion&gt;
  
                                  ))
  
                              }
  
                          &lt;/List.AccordionGroup&gt;
                      )}
                  &lt;/View&gt;
              &lt;/ScrollView&gt;
  </code></pre>
  <p><strong>server.js</strong></p>
  <pre><code>const express = require('express')
  const app = express()
  const bodyParser = require('body-parser')
  const mongoose = require('mongoose')
  require('./User')
  
  app.use(bodyParser.json())
  
  const User = mongoose.model(&quot;user&quot;)
  
  const mongoUrl = &quot;MY_URL&quot;
  
  mongoose.connect(mongoUrl, {
      useNewUrlParser: true,
      useUnifiedTopology: true
  })
  
  mongoose.connection.on(&quot;connected&quot;, () =&gt; {
      console.log(&quot;Connected to Mongo&quot;)
  })
  
  mongoose.connection.on(&quot;error&quot;, (err) =&gt; {
      console.log(&quot;Error: &quot;, err)
  })
  
  app.get('/', (req, res) =&gt; {
      User.find({}).then(data =&gt; {
          res.send(data)
      })
      .catch(err =&gt; {
          console.log(err)
      })
  })
  app.post('/closed', (req, res) =&gt; {
      User.findByIdAndUpdate(req.body.id, {
          name: req.body.name,
          request: req.body.request,
          subject: req.body.subject,
          location: req.body.location,
          category: req.body.category,
          priority: req.body.priority,
          desc: req.body.desc,
          status: req.body.status
      }).then(data =&gt; {
          console.log(data)
          res.send(data)
      })
      .catch(err =&gt; {
          console.log(err)
      })
  })
  app.post('/send-data', (req, res) =&gt; {
      const user = new User({
          name: req.body.name,
          request: req.body.request,
          subject: req.body.subject,
          category: req.body.category,
          priority: req.body.priority,
          desc: req.body.desc,
          location: req.body.location,
          status: req.body.status
      })
      user.save()
          .then(data =&gt; {console.log(data)
          res.send(data)
      }).catch(err =&gt; {
          console.log(err)
      })
  })
  app.listen(3000, () =&gt; {
      console.log(&quot;server running&quot;)
  })
  </code></pre>
  <p>My data which is stored in mongodb</p>
  <pre><code>_id:602cd535a41dba58d861ac9c
  name:&quot;ReactJS&quot;
  request:&quot;Dhanjay&quot;
  subject:&quot;Ticket stuck&quot;
  category:&quot;IT&quot;
  priority:&quot;&quot;
  desc:&quot;No reply&quot;
  location:&quot;Pune&quot;
  status:&quot;Open&quot;
  __v:0
  
  _id:602cd5aca41dba58d861ac9d
  name:&quot;Access Restriction&quot;
  request:&quot;Dhanjay&quot;
  subject:&quot;No access&quot;
  category:&quot;IT&quot;
  priority:&quot;&quot;
  desc:&quot;SharePoint access&quot;
  location:&quot;Pune&quot;
  status:&quot;Open&quot;
  __v:0
  
  </code></pre>
  <p>This was the error I was getting and the server is also sending null:</p>
  <pre><code>[Unhandled promise rejection: SyntaxError: JSON Parse error: Unexpected EOF]
  * [native code]:null in parse
  - node_modules\react-native\node_modules\promise\setimmediate\core.js:37:13 in tryCallOne
  - node_modules\react-native\node_modules\promise\setimmediate\core.js:123:24 in setImmediate$argument_0
  - node_modules\react-native\Libraries\Core\Timers\JSTimers.js:130:14 in _callTimer
  - node_modules\react-native\Libraries\Core\Timers\JSTimers.js:181:14 in _callImmediatesPass
  - node_modules\react-native\Libraries\Core\Timers\JSTimers.js:441:30 in callImmediates
  - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:387:6 in __callImmediates
  - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:135:6 in __guard$argument_0
  - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:364:10 in __guard
  - node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:134:4 in flushedQueue
  * [native code]:null in flushedQueue
  * [native code]:null in invokeCallbackAndReturnFlushedQueue
  </code></pre>