---
title: "Comment by Bhanu Teja Pachipulusu on \"Introduction to React Context API with Firebase Authentication\" | Hashnode"
description: "Nice article. Thanks for this. I have seen that even though the value that you passed to the context is not a primitive value, you did not use useMemo . Can you"
url: "https://hashnode.com/posts/introduction-to-react-context-api-with-firebase-authentication/5f45c16dc71d3225c1e990e3/comment/5f4871373ba45c3bb00eea79"
---

[Discussion](https://hashnode.com/posts/introduction-to-react-context-api-with-firebase-authentication/5f45c16dc71d3225c1e990e3)

Comment [Introduction to React Context API with Firebase Authentication](https://hashnode.com/posts/introduction-to-react-context-api-with-firebase-authentication/5f45c16dc71d3225c1e990e3)

[Bhanu Teja Pachipulusu](https://hashnode.com/@pbteja1998)

[Aug 28, 2020](https://hashnode.com/posts/introduction-to-react-context-api-with-firebase-authentication/5f45c16dc71d3225c1e990e3/comment/5f4871373ba45c3bb00eea79)

Nice article. Thanks for this.

I have seen that even though the value that you passed to the context is not a primitive value, you did not use `useMemo`.

Can you tell me what will be the implications of (not) using `useMemo` here and when do you suggest that we should use it.

Which rerenders will this `useMemo` reduces when used along with `useContext`?

[Victoria Lo](https://hashnode.com/@victoria)

[Aug 28, 2020](https://hashnode.com/posts/introduction-to-react-context-api-with-firebase-authentication/5f45c16dc71d3225c1e990e3/comment/5f4871373ba45c3bb00eea79#reply-5f495a38c736b44e8f925bd7)

Hi Bhanu, thanks for the question.

According to official docs, `useMemo` will only recompute the memoized value when one of the dependencies has changed.

In this case, `onAuthStateChanged()` does the job of useMemo so there's no need to use it.

In general, it is useful for when you need to optimize performance by avoiding expensive computation functions.

```
const memoizedValue = useMemo(() => computeExpensiveValue(a, b), [a, b]);
```

I will write a more detailed article in the future. Thank you!
