# Navigation

## Navigate[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#navigate) <a href="#navigate" id="navigate"></a>

Open a different block from the app. The block will be shown in a dialog-like fashion with a close button instead of a back button.

```javascript
import { navigate } from '@myjsblock/sdk'

await navigate('List6');
// List6 was closed
```

#### Passing properties[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#passing-properties) <a href="#passing-properties" id="passing-properties"></a>

Data can be passed to the page by using the `properties` argument. Data will be exposed in to the block via the data fields and `{data:<name>}` template syntax. For example, for payment and checkout pages or other detail pages.

```javascript
import { navigate } from '@myjsblock/sdk'

await navigate('List6', {
    paymentId: '123456'
});

// List6 was closed
```

#### Arguments[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#arguments) <a href="#arguments" id="arguments"></a>

| Name           | Type                   | Required | Default |
| -------------- | ---------------------- | -------- | ------- |
| `variableName` | *String*               | ✅        | -       |
| `properties`   | *{ \[key]: anyValue }* |          | -       |

#### Errors[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#errors) <a href="#errors" id="errors"></a>

Here is a list of errors that can be thrown when calling this function in addition to [generic errors](/developers/javascript/sdk/core.md#generic-errors):

| Error Code         | Description                                          |
| ------------------ | ---------------------------------------------------- |
| `INVALID_ARGUMENT` | There is no block with variable name `variableName`. |

## Go Back[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#go-back) <a href="#go-back" id="go-back"></a>

Great for custom back buttons. By calling this function the user will be navigated back to the previous block, like pressing back on the device.

```javascript
import { goBack } from '@myjsblock/sdk'

await goBack();
```

#### Example[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#example) <a href="#example" id="example"></a>

```javascript
import { goBack } from '@myjsblock/sdk'

async function onPaymentComplete() {
    await goBack(
      true
    );
}
```

#### Arguments <a href="#errors-1" id="errors-1"></a>

| Name     | Type    | Required | Default |
| -------- | ------- | -------- | ------- |
| `reload` | Boolean |          | false   |

#### Errors[​](https://docs.appmachine.com/libraries/javascript/sdk/api/navigation#errors-1) <a href="#errors-1" id="errors-1"></a>

Here is a list of errors that can be thrown when calling this function in addition to [generic errors](/developers/javascript/sdk/core.md#generic-errors):

<br>


---

# Agent Instructions: 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.appmachine.com/developers/javascript/sdk/navigation.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.
