# RTL + Jest useState not updating the values

**URL:** <https://forum.ionicframework.com/t/rtl-jest-usestate-not-updating-the-values/209021>\
**Category:** Ionic React\
**Created:** [May 4, 2021, 6:34am UTC](https://forum.ionicframework.com/t/rtl-jest-usestate-not-updating-the-values/209021 "2021-05-04T06:34:49Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sidra-nasir](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@sidra-nasir](https://forum.ionicframework.com/u/sidra-nasir)\
**Post date:** [May 4, 2021, 6:34am UTC](https://forum.ionicframework.com/t/rtl-jest-usestate-not-updating-the-values/209021/1 "2021-05-04T06:34:49Z")

</div>

this is my project code  
const classes = useStyles();

const [projectName, setProjectName] = useState("--------");

const [projectDescription, setProjectDescription] = useState("-------");

let { id } = useParams();

const [isSubmitting, setSubmitting] = useState(false);

const [loading, setLoading] = useState(true);

when trying to update the useState in testcase like this:

const setState = jest.fn();

```
const useStateSpy = jest.spyOn(React, 'useState');

useStateSpy.mockImplementationOnce( (projectName) => [projectName= "Test Project" , setState]);

useStateSpy.mockImplementationOnce((projectDescription) => [projectDescription = "Test Data" , setState]);

```

these values of projectname and project description not changing,.

---

<div class="post-metadata">

**Author:** ![sidra-nasir](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@sidra-nasir](https://forum.ionicframework.com/u/sidra-nasir)\
**Post date:** [May 7, 2021, 5:53am UTC](https://forum.ionicframework.com/t/rtl-jest-usestate-not-updating-the-values/209021/2 "2021-05-07T05:53:26Z")

</div>

if someone has any solution, please share it
