3 Creating components
This chapter covers
- Creating Svelte components
- Styling Svelte components
- Implementing logic in Svelte components
- Defining and updating state in Svelte components
In this chapter we will delve deeper into defining components by creating .svelte
files. These files specify the JavaScript that implements state and logic, the HTML to be rendered, and the CSS that will style them.
Components are the fundamental building blocks of web applications in most frameworks. Components are composed of closely related portions of a user interface. They can encapsulate data that is specific to their part of the UI, often referred as state. They split a UI into potentially reusable parts.
Some components represent entire pages while others ...
Get Svelte and Sapper in Action now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.