ovide an alternative value when the Promise passed to ` use
` is rejected you can use the Promise’s  [ ` catch `
](https://developer.mozilla.org/en-
US/docs/Web/JavaScript/Reference/Global_Objects/Promise/catch) method.

    
    
    import { Message } from './message.js';  
    
    
      
    
    
    export default function App() {  
    
    
      const messagePromise = new Promise((resolve, reject) => {  
    
    
        reject();  
    
    
      }).catch(() => {  
    
    
        return "no new message found.";  
    
    
      });  
    
    
      
    
    
      return (  
    
    
        <Suspense fallback={<p>waiting for message...</p>}>  
    
    
          <Message messagePromise={messagePromise} />  
    
    
        </Suspense>  
    
    
      );  
    
    
    }

To use the Promise’s  ` catch ` method, call  ` catch ` on the Promise object.
` catch ` takes a single argument: a function that takes an error message as
an argument. Whatever is  returned  by the function passed to  ` catch ` will
be used as the resolved value of the Promise.

* * *

##  Troubleshooting

###  “Suspense Exception: This is not a real error!”

You are either calling ` use ` outside of a React component or Hook function,
or calling ` use ` in a try–catch block. If you are calling ` use ` inside a
try–catch block, wrap your component in an error boundary, or call the
Promise’s ` catch ` to catch the error and resolve the Promise with another
value.  See these examples  .

If you are calling ` use ` outside a React component or Hook function, move
the ` use ` call to a React component or Hook function.

    
    
    function MessageComponent({messagePromise}) {  
    
    
      function download() {  
    
    
        // ❌ the function calling `use` is not a Component or Hook  
    
    
        const message = use(messagePromise);  
    
    
        // ...

Instead, call ` use ` outside any component closures, where the function that
calls ` use ` is a component or Hook.

    
    
    function MessageComponent({messagePromise}) {  
    
    
      // ✅ `use` is being called from a component.   
    
    
      const message = use(messagePromise);  
    
    
      // ...

[ Previous  Hooks  ](/reference/react/hooks) [ Next  useCallback
](/reference/react/useCallback)

* * *

How do you like these docs?

[ Take our survey!  ](https://www.surveymonkey.co.uk/r/PYRPF3X)

* * *

[ ](https://opensource.fb.com/)

©  2024

[ Learn React ](/learn)

[ Quick Start ](/learn)

[ Installation ](/learn/installation)

[ Describing the UI ](/learn/describing-the-ui)

[ Adding Interactivity ](/learn/adding-interactivity)

[ Managing State ](/learn/managing-state)

[ Escape Hatches ](/learn/escape-hatches)

[ API Reference ](/reference/react)

[ React APIs ](/reference/react)

[ React DOM APIs ](/reference/react-dom)

[ Community ](/community)

[ Code of Conduct
](https://github.com/facebook/react/blob/main/CODE_OF_CONDUCT.md)

[ Meet the Team ](/community/team)

[ Docs Contributors ](/community/docs-contributors)

[ Acknowledgements ](/community/acknowledgements)

More

[ Blog ](/blog)

[ React Native ](https://reactnative.dev/)

[ Privacy ](https://opensource.facebook.com/legal/privacy)

[ Terms ](https://opensource.fb.com/legal/terms/)

[ ](https://www.facebook.com/react) [ ](https://twitter.com/reactjs) [
](https://github.com/facebook/react)

##  On this page

  * Overview 
  * Reference 
  * ` use(resource) `
  * Usage 
  * Reading context with ` use `
  * Streaming data from the server to the client 
  * Dealing with rejected Promises 
  * Troubleshooting 
  * “Suspense Exception: This is not a real error!”