Skip to the content

Lesson 9 of 21 · Components

Props

A component is a file with an uppercase name. prop declares a value that the parent gives. A prop with = has a default value, so the parent does not have to give it.import Badge from "./Badge.surf" names a file relative to this file. This lesson has two files.Your turn
  • Add the prop tone: String = "plain" to Greeting.surf. Show it in the text.
  • In App.surf, give the second greeting tone="warm".
Preview
1 error
The sandbox needs a browser.