---
url: /mobx-view-model/v9/errors/2.md
---
# &#x20;Error `#2`: `ViewModel` not found

This happened because the [`vmLookup`](/api/other/view-model-lookup) provided for the [`useViewModel`](/react/api/use-view-model) hook was not found in [`ViewModelStore`](/api/view-model-store/overview).

## Explanation:

Hook

```tsx
const model = useViewModel(YourVM);
```

Will use [`ViewModelStore`](/api/view-model-store/overview) to find your instance of provided `YourVM` [`ViewModel`](/api/view-models/overview).\
It means that your `ViewModel` is not created yet and not registered in `ViewModelStore`, or you have not declared the creation of this `ViewModel` anywhere.

## Potential solution

Create and register your `ViewModel` using [`useCreateViewModel`](/react/api/use-create-view-model) hook or [`withViewModel`](/react/api/with-view-model) HOC.

```tsx
const model = useCreateViewModel(YourVM);
```

You can also create and register your `ViewModel` using the [ViewModelStore.attach() method](/api/view-model-store/interface#attach-viewmodel), but then you will need to reproduce the full creation and destruction cycle, which is implemented inside the hook.
