title: Jetpack Compose - pass an object through composable callback
body: <p>In this app, I have a screen where you can enter a title and content for a Note.</p>
  <p>The screen has two composables <strong>DetailScreen()</strong> and <strong>DetailScreenContent</strong>.</p>
  <p>Detailscreen has the scaffold and appbars and calls DetailScreenContents() which has two TextFields and a button.</p>
  <p>I'm expecting the user to enter text in these fields and then press the button which will package the text into a <strong>NOTE</strong> object. My question is, how to pass the <em><strong>NOTE</strong></em> to the upper composable which is <strong>DETAILSCREEN()</strong> with a callback like=
  onclick: -&gt; Note or any other efficient way?</p>
  <pre class="lang-kotlin prettyprint-override"><code>@Composable
  fun DetailScreen(navCtl : NavController, mviewmodel: NoteViewModel){
  
  Scaffold(bottomBar = { TidyBottomBar()},
           topBar = { TidyAppBarnavIcon(
               mtitle = &quot;&quot;,
               onBackPressed = {navCtl.popBackStack()},
  
           )
           }) {
      DetailScreenContent()
     }
  }
  
  
  
  @Composable
  fun DetailScreenContent() {
  val titleValue = remember { mutableStateOf(&quot;&quot;)}
  val contentValue = remember { mutableStateOf(&quot;&quot;)}
  val endnote by remember{ mutableStateOf(Note(
      Title = titleValue.value,
      Content = contentValue.value))}
  
  
  Column(modifier = Modifier.fillMaxSize()) {
  
      OutlinedTextField(value = titleValue.value,
          onValueChange = {titleValue.value = it},
          singleLine = true,
          label = {Text(&quot;&quot;)}
      ,modifier = Modifier
              .fillMaxWidth()
              .padding(start = 3.dp, end = 3.dp),
          shape = cardShapes.small
      )
  
      OutlinedTextField(value = contentValue.value, onValueChange = {
          contentValue.value = it
      },
          label = {Text(&quot;Content&quot;)}
          ,modifier = Modifier
              .fillMaxWidth()
              .padding(start = 3.dp, end = 3.dp, top = 3.dp)
              .height(200.dp),
          shape = cardShapes.small,
  
      )
  
    Row(horizontalArrangement = Arrangement.End,
        modifier = Modifier.fillMaxWidth()){
        Button(onClick = {
                         /**return the object to the upper composable**/
        }, shape = cardShapes.small) {
            Text(text = stringResource(R.string.Finish))
        }
        
    }
  
  }
  </code></pre>