title: how to create new instance of a fragment which has dagger inject
body: <p>Hi I am injecting <code>mainActivityViewModel</code> into my fragment using constructor injection, I have a companion object within the fragment which creates an instance of the fragment.
  how can I create instance from the main activity</p>
  <p>RetroComponent - dagger</p>
  <pre><code>@Singleton
  @Component(modules = [RetroModule::class])
  interface RetroComponent {
  
      fun inject(mainActivityViewModel: MainActivityViewModel)
  }
  </code></pre>
  <p>Fragment</p>
  <pre><code>class CreditScoreFragment @Inject constructor(
      private val viewModel: MainActivityViewModel
  ) : Fragment() {
  
      private fun initViewModel() {
          viewModel.getCreditReport()
      }
  
     companion object {
          @JvmStatic
          fun newInstance() =
              CreditScoreFragment(viewModel).apply {
  
              }
  
      }
  }
  </code></pre>
  <p>Activity</p>
  <pre><code>class MainActivity : AppCompatActivity() {
      override fun onCreate(savedInstanceState: Bundle?) {
          super.onCreate(savedInstanceState)
          setContentView(R.layout.activity_main)
          setupFragment()
      }
  
      private fun setupFragment() {
          val fragment = CreditScoreFragment.newInstance()
          val fragmentManager: FragmentManager = supportFragmentManager
          val fragmentTransaction: FragmentTransaction = fragmentManager.beginTransaction()
          fragmentTransaction.replace(android.R.id.content, fragment)
          fragmentTransaction.commit()
      }
  }
  </code></pre>
  <p>How should I call CreditScoreFragment.newInstance() and how to pass the <code>MainActivityViewModel</code> which is required for the fragment</p>
  <p>thanks in advance
  R</p>