title: How to inject a ViewModel into a composable function using Hilt (Jetpack Compose)
body: <p>I'm doing the same as shown in the documentation <a href="https://developer.android.com/jetpack/compose/libraries#hilt" rel="noreferrer">here</a>.
  I want to Inject the ViewModel into a Composable function (Screen), but I get this error:</p>
  <blockquote>
  <p>Cannot create an instance of class
  com.example.blotube.ui.later.LaterViewModel</p>
  </blockquote>
  <p><strong>My ViewModel:</strong></p>
  <pre><code>@HiltViewModel
  class LaterViewModel @Inject constructor(
      private val database: Database
  ):ViewModel() {
  
      val watchLater=database.videos().getAll()
  
  }
  </code></pre>
  <p><strong>My Composable Function (Screen):</strong></p>
  <pre><code>@Composable
  fun WatchLater(vm: LaterViewModel = viewModel()){
  
  
      val videos=vm.watchLater.observeAsState()
      val context= LocalContext.current
      
  
  }
  </code></pre>