Skip to content
pablichjenkov edited this page Jan 13, 2023 · 31 revisions

Getting started!

The best way to get started is by creating a hello world app, are you ready?

A simple node will look something like this:

class HelloWorldNode : Node() {

    private val helloWorldState = HelloWorldState()

    @Composable
    override fun Content(modifier: Modifier) {
        HelloWorldView(helloWorldState)
    }

}

@Composable
private fun HelloWorldView(helloWorldState: HelloWorldState) {

    val userName = helloWorldState.userName

    Column(
        modifier = Modifier.fillMaxSize(),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Text("Enter your name:")
        OutlinedTextField(
            value = userName,
            onValueChange = {
                helloWorldState.userName = it
            }
        )
        Text("Great to meet you: $userName")
    }
}

private class HelloWorldState {
    var userName by mutableStateOf("")
}

when you run above code you will get:

Android uistate3-hello-world

JVM uistate3-hello-world

Browser uistate3-hello-world

Clone this wiki locally