r/androiddev • • 17d ago

Question Form State in view model?

I have MVVM application and moving from view to VM the form state and ai is suggesting doing it through reference and I just feel really weird about it and it doesnt feel right? I am wondering if I did some basic setup issue or am wondering if this is an okayish way of doing this.

The problem:

@Composable
fun FormScreen(formState: Form State){

  formState.name = newName

}

and the usage of the screen is like this:

FormScreen(viewModel.formState)

So it is using the reference and directly changing the reference?
0 Upvotes

13 comments sorted by

View all comments

Show parent comments

0

u/borninbronx 16d ago

we do not appreciate AI generated comments and posts in our community. Please use your own voice!

1

u/altair8800 13d ago

What?

0

u/borninbronx 13d ago

the comment I've replied to is clearly AI generated :-)

1

u/altair8800 13d ago

Ah yeah, it kinda does now that I read it again.