I am using form in reactjs. I stored user data in localstorage now I want to upload file and i want to store file key with userID which is already stored in localstorage. With `localstorage.getItem('user')` I am able to show user values but did not use in key, when i display user values in console it give me message with undefined. Could you please help me how i can set key with userid. 

**Code**

```
    handleUpload = e => {
    const reader = new FileReader();
    const storeUser = JSON.parse(localStorage.getItem('user'));
    reader.onload = function(upload) {
      fetch(`http://...../s3/uploadtoaws`, {
        headers: {
          Accept: 'application/json',
          'Content-Type': 'application/json',
        },
        method: 'POST',
        body: JSON.stringify({
          userId: storeUser._id,
          type: 'employee',
          content: upload.target.result,
          key: this.userId,
          oldKey: '',
        }),
      })
        .then(response => response.json())
        .then(res => {
          console.warn(res);
        })
        .done();
    };

    reader.readAsDataURL(e.file.originFileObj);
  };

```