Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Real-World Svelte
  • Table Of Contents Toc
Real-World Svelte

Real-World Svelte

By : Hau
4.5 (17)
close
close
Real-World Svelte

Real-World Svelte

4.5 (17)
By: Hau

Overview of this book

Svelte has quickly become a popular choice among developers seeking to build fast, responsive, and efficient web applications that are high-performing, scalable, and visually stunning. This book goes beyond the basics to help you thoroughly explore the core concepts that make Svelte stand out among other frameworks. You’ll begin by gaining a clear understanding of lifecycle functions, reusable hooks, and various styling options such as Tailwind CSS and CSS variables. Next, you’ll find out how to effectively manage the state, props, and bindings and explore component patterns for better organization. You’ll also discover how to create patterns using actions, demonstrate custom events, integrate vanilla JS UI libraries, and progressively enhance UI elements. As you advance, you’ll delve into state management with context and stores, implement custom stores, handle complex data, and manage states effectively, along with creating renderless components for specialized functionalities and learning animations with tweened and spring stores. The concluding chapters will help you focus on enhancing UI elements with transitions while covering accessibility considerations. By the end of this book, you’ll be equipped to unlock Svelte's full potential, build exceptional web applications, and deliver performant, responsive, and inclusive user experiences.
Table of Contents (22 chapters)
close
close
1
Part 1: Writing Svelte Components
6
Part 2: Actions
10
Part 3: Context and Stores
16
Part 4: Transitions

Example – integrating CodeMirror

CodeMirror is a code editor component that has many great features for editing, such as syntax highlighting, code folding, and more.

You can find the CodeMirror documentation at https://codemirror.net/.

At the time of writing, CodeMirror is currently at version 5.65.9.

After installing the codemirror library using the package manager of our choice, we can import codemirror into our code:

import CodeMirror from 'codemirror';
import 'codemirror/lib/codemirror.css';

Now, we can initialize CodeMirror with the following constructor function:

const myCodeMirror = CodeMirror(document.body);

Here, we pass in the element where we want the CodeMirror code editor to be.

Before I continue, at this point, note that we are looking for the same set of things from CodeMirror:

  • Methods to initialize CodeMirror
  • Any method needed to clean up a CodeMirror instance
  • Any method to update a CodeMirror instance...
CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Real-World Svelte
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist download Download options font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon