> For the complete documentation index, see [llms.txt](https://docs.appmachine.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.appmachine.com/developers/javascript/sdk/navigation.md).

# 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>
