> For the complete documentation index, see [llms.txt](https://docs.conanjs.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.conanjs.io/data/flows/testing-flows.md).

# Observing Flows

## Introduction

As described on the [serialising flows](/data/flows/flows-as-state.md), you should be able to serialise a Flow to a ConanState that suits you, and then leverage all the features of the [Conan State](/data/conan-state.md) to observe it.

We have though some mechanisms to provide you with a shortcut when observing flows

{% hint style="danger" %}
As of v1.0 we only have hooks, but we are planning to add more shortcuts to observe directly flows without having to serialise them
{% endhint %}

## Hooks

### useFlow

```typescript
useFlow<AuthenticationState,AuthenticationFlow>(
        authentication$F, 
        setState, 
        (status, previousState) => ({
                ...previousState,
                current: status.name,
        })
);
```

This hook receives&#x20;

* a flow
* the method to set the state for this component
* a function that returns the new state and that takes
  * the status information that has just been updated
  * the previous state

### useFlowStatus

```typescript
useFlowStatus<AuthenticationState, AuthenticationFlow,"authenticating">(
        authentication$F, 
        "authenticating", 
        setState, 
        (status, previousState) => ({
                ...previousState,
                currentUser: status[0]
         }
 ));
```

This hook receives&#x20;

* a flow
* the name of the status to subscribe to
* the method to set the state for this component
* a function that returns the new state and that takes
  * the state information that has just been updated
  * the previous state

{% hint style="info" %}
To see an example of hooks, check our demo [Authentication](/tutorials/conan-flow-demos/authentication.md)
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.conanjs.io/data/flows/testing-flows.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
