SolidJS: The Complete Guide
$32.00
Minimum price
$44.00
Suggested price

SolidJS: The Complete Guide

A comprehensive guide to reactive web development with SolidJS and TypeScript

About the Book

SolidJS: The Complete Guide is the most comprehensive resource available for learning SolidJS from the ground up. Whether you’re just curious about reactive UI frameworks or you’re an experienced React or Vue developer looking for a faster, more predictable alternative, this book will guide you step by step.

Starting with the fundamentals of Solid’s reactivity system, you’ll explore signals, effects, memos, computations, and JSX rules before diving into advanced topics like context, stores, directives, asynchronous data handling, routing, and server-side rendering. Each chapter builds on the previous one, ensuring you gain both a conceptual understanding and practical experience.

The book also covers Solid Router and SolidStart, giving you practical insights into building modern, production-ready applications. Through plenty of hands-on examples, you’ll learn routing strategies, data fetching, authentication, server functions, and full-stack development patterns—everything you need to ship real-world SolidJS apps with confidence.

By the end, you’ll be ready to build scalable, reactive, and production-grade applications with SolidJS and SolidStart.

Please scroll down to see the full table of contents and explore the topics covered in detail.

  • Share this book

  • Categories

    • JavaScript
    • TypeScript
    • Computers and Programming
    • SolidJS
    • SolidStart
    • Software Engineering
  • Feedback

    Email the Author(s)

About the Author

Table of Contents

  • 1. Introduction
    1. Code Examples
    2. Contact and Feedback
    3. Requirements
    4. Trying Solid via Online Playground
    5. Creating a Project From a Template
    6. Note For React Developers
  • 2. Setting Up a Development Environment
  • 3. On SolidJS
    1. The Problem Solid Solves
    2. How Solid Works?
      1. Reactive Data
      2. Composable UI
    3. The Advantages of Solid Over Its Alternatives
  • 4. How Solid’s Reactive System Works
    1. Observer Pattern
    2. The Essence of Reactive Core
      1. Improving Type Definitions for createComputation
      2. Deriving Reactive Values from Signals
    3. Uses of Computations
  • 5. Tracking State with Signals
    1. Overwriting the Comparison Logic
    2. Updating Signals
    3. Deriving Values
    4. Destructuring Signals
    5. Batching Updates
  • 6. Running Side-Effects with Effects
    1. Effects Can Be Nested
    2. Explicit Dependency Tracking
    3. Opting Out of Tracking
    4. Handling External Dependencies
  • 7. Caching Values with Memos
  • 8. Rules of JSX
    1. Elements Should Be Closed
    2. Elements Can Be Nested
    3. Expressions Can Be Used Inside JSX Elements
    4. Elements Can Have Attributes
    5. Missing Attribute Values Default to true
    6. Comments
    7. Whitespaces Are Trimmed
  • 9. Composing User Interfaces
    1. Components Should Return a Single Root Element
    2. Components Accept Data Through Their props
    3. Adding Static Types to Components
    4. Components Can Have Children
    5. How Components Are Rendered
    6. Conditional Rendering
    7. Reactive props
    8. Props Should Be Treated as Read-Only
    9. Destructuring Props Changes the Rendering Order
    10. Effects Are Executed After Rendering
    11. Best Practices
  • 10. Working with Props
    1. Passing Data From Parent to Child
    2. Sharing State Between Children
      1. Providing Controlled Access to Parent’s State
    3. Passing Data From Child to Parent
    4. Destructuring and Spreading Props
    5. Forwarding Multiple Props at Once
    6. Validating Props
  • 11. Sharing Data Through the Context API
    1. How Context API Works
    2. Best Practices
  • 12. Component Lifecycle
    1. onMount
    2. onCleanup
    3. Best Practices
  • 13. Accessing DOM Nodes With `ref`
    1. When ref Functions Execute
    2. Forwarding Refs
    3. Using Refs with External Libraries
    4. Best Practices
  • 14. Working with Computations
    1. createComputed
    2. createRenderEffect
    3. createEffect
    4. createMemo
    5. createDeferred
    6. createReaction
  • 15. Handling Errors
    1. ErrorBoundary
    2. catchError
    3. Handling Asynchronous Errors
  • 16. Working with Owners
    1. Accessing Currently Executing Computation
    2. Reactivity in Asynchronous Context
  • 17. Styling Elements
    1. Using Inline Styles
    2. Applying Style Definitions
    3. Applying Classes Conditionally
    4. Using the Imperative API
  • 18. Reactive Utilities
    1. batch
    2. untrack
    3. on
    4. createRoot
    5. mergeProps
    6. splitProps
      1. Why Use splitProps and mergeProps?
    7. mapArray and indexArray
    8. observable
    9. from
    10. startTransition and useTransition
  • 19. A Better Conditional Rendering
    1. Show
      1. Keyed Rendering
      2. Render Props
    2. Switch and Match
  • 20. Working with Lists
    1. For
    2. mapArray
    3. Index
    4. indexArray
    5. Selecting Items with Selectors
  • 21. Rendering Components Outside the Component Hierarchy
  • 22. Managing Complex States with Stores
    1. Accessing Data
    2. Updating Stores
    3. Limitations Related to Reactivity
    4. Store Utilities
      1. produce
      2. reconcile
      3. unwrap
      4. createMutable
  • 23. Abstracting Behavior With Custom Directives
    1. Extending JSX Type with Custom Directives
    2. Using Imported Directives
  • 24. Working with Asynchronous Data
    1. Decoupling Fetching From Rendering
  • 25. Using Resource API for Data Fetching
    1. Info Object
    2. Resource Actions
    3. Error Handling with Resources
      1. Display the Error in the UI
      2. Rethrow During Rendering
      3. Rethrow inside an Effect or Computated
    4. Paginated Data with Resources: A Book List Example
  • 26. Managing Loading States with Suspense
  • 27. Achieving Better Consistency with Transitions
  • 28. Coordinating Loading States
  • 29. Code Splitting and Lazy Loading
  • 30. Handling Events
    1. Using JSX Attributes with the on Prefix
    2. Using JSX Attributes with the on: Prefix
    3. Using Custom Properties
    4. Using Refs
    5. Using Custom Directives
    6. Passing Data to Event Handlers
  • 31. Dynamically Rendering Components
  • 32. Solid Without JSX
    1. Solid with Tagged Template Literals
    2. Solid with Hyperscript
    3. Drawbacks
  • 33. Server Side Rendering
    1. Issues With Single Page Applications
    2. SSR: Visible Content From the First Byte
    3. Three Rendering Approaches for SSR Applications
    4. renderToString - Synchronous HTML Generation
    5. renderToStringAsync - Asynchronous HTML Generation
    6. renderToStream - Streaming with Progressive Rendering
    7. Hydration: Breathing Life into Server-Rendered Pages
    8. Targeting the Server Context
    9. Targeting the Development Build
    10. Practical Guide to Server-Rendering
    11. Separating Application Shell from Client Logic
    12. Building a Full-Stack App with Express and Solid Router
  • 34. Solid Router
    1. Setting Up Development Environment
      1. Client-Only Development Environment
      2. SolidStart Development Environment
    2. Installing Solid Router
    3. Routing Strategies
    4. Anatomy of a URL
      1. Clean URLs
    5. Introducing the Router Component
      1. Error Handling Considerations
    6. Defining Routes
    7. Lazy Loading Route Components
    8. Matching Dynamic Paths
    9. Filtering Dynamic Paths
    10. Optional Parameters
    11. Catch-All Routes and Handling 404s
      1. Named Wildcards for Flexibility
      2. Wildcards Beyond Catch-All Routes
      3. Use Cases for Wildcard Routes
      4. Matching Multiple Paths in a Route
      5. Attaching Metadata
    12. Layouts
      1. Rendering Different Layouts Conditionally
      2. Rendering Different Layouts via Nested Routes
    13. Nested Routes
      1. Providing a Shared Layout
      2. Nested Routes via Configuration
    14. Alternative Routers
      1. Hash Mode Router
      2. Memory Router
    15. Linking and Navigation
      1. Using Anchor Elements
        1. Targeting New Tabs or Frames
        2. Adding Keyboard Shortcuts with accesskey
        3. Security Considerations for Anchor Elements
      2. Using the A Component
      3. Programmatic Navigation
      4. The redirect Function
        1. Using redirect in Queries and Actions
        2. Single Flight Mutations
        3. throw vs return
    16. Hosting Apps in Subdirectories
    17. Preloading
      1. Inside the preload Function
      2. Manually Preloading with usePreloadRoute
    18. Accessing Route Related Data
      1. Accessing URL Information with useLocation
      2. Managing Query Parameters with useSearchParams
      3. Extracting Route Parameters with useParams
      4. Matching Routes with useMatch and useCurrentMatches
    19. Displaying Transition Indicators
    20. Intercepting Route Changes with useBeforeLeave
    21. Fetching Async Data
    22. Deduplicated Data Fetching
    23. Updating Remote Data With Web Forms
      1. Working With Web Forms
      2. Collecting User Inputs and Performing Data Updates
      3. Providing Unique Names For Serialization
      4. Passing Arguments Directly
      5. Programmatically Invoking Actions
      6. Handling Form Errors
      7. Helper Functions
      8. Tracking Form Submissions with useSubmission and useSubmissions
    24. Reactive Forms with Authentication and Validation
  • 35. Isomorphic Apps with SolidStart
    1. Introducing SolidStart
    2. Project Setup & Configuration
    3. Project Structure
    4. Building Navigation with File-Based Routes
      1. Dynamic Parameters
      2. Optional Parameters
      3. Catch-All Routes
      4. Logical Naming for Cleaner File Organization
        1. Renaming index.tsx for Discoverability
        2. Using Folders for Logical Grouping
      5. Escaping Folder-Based Nesting
      6. Creating Shared Page Structures with Layouts
      7. Defining Layouts for Nested Routes
        1. Escaping Nested Layouts
    5. Serving Static Assets
      1. Using import Statements
    6. Styling Components
      1. Using Stylesheets
      2. Using CSS Modules
      3. CSS-in-JS
    7. Data Exchange Between the Server and Client
      1. Basic Data Fetching: API Endpoints
      2. Idiomatic Data Fetching: Server Functions
      3. Performing Server-Side Mutations: Server Actions
    8. Caching Data for Request Deduplication
    9. Preloading Data
    10. Pre-rendering Routes
    11. Registering API Endpoints
      1. Using the file router API
      2. Using application configuration
      3. Using a Middleware
      4. Using the GET function
    12. Accessing Server Events
    13. Managing <head> Elements
    14. Setting HTTP Headers and Status Codes
      1. Setting HTTP Headers
      2. Setting HTTP Status Codes
    15. Creating Client-Only Components
    16. Building Echoes: A Quote Management App with SolidStart
      1. Project Setup
      2. Application Structure and Routes
        1. Route Organization
        2. Protected Routes
        3. Public Routes
      3. Application Layout
      4. Styling
      5. Error Handling
      6. Fetching Data
      7. Updating Data
    17. Authentication and Authorization
      1. Notifications and Confirmation Dialogs
        1. Mounting the Client-Only Layers
        2. Notifications: Decoupled, Event-Driven Toasts
        3. Confirmation Dialogs: Explicit Consent for Destructive Actions
    18. Closing Thoughts
  • A1. Setting Development Environment Using Webpack
    1. Install Dependencies
    2. Configuring Webpack
    3. Configure the Webpack Dev Server
    4. Add TypeScript Support
    5. Add Eslint Support
    6. Create a Basic Application
  • About the Author

The Leanpub 60 Day 100% Happiness Guarantee

Within 60 days of purchase you can get a 100% refund on any Leanpub purchase, in two clicks.

Now, this is technically risky for us, since you'll have the book or course files either way. But we're so confident in our products and services, and in our authors and readers, that we're happy to offer a full money back guarantee for everything we sell.

You can only find out how good something is by trying it, and because of our 100% money back guarantee there's literally no risk to do so!

So, there's no reason not to click the Add to Cart button, is there?

See full terms...

Earn $8 on a $10 Purchase, and $16 on a $20 Purchase

We pay 80% royalties on purchases of $7.99 or more, and 80% royalties minus a 50 cent flat fee on purchases between $0.99 and $7.98. You earn $8 on a $10 sale, and $16 on a $20 sale. So, if we sell 5000 non-refunded copies of your book for $20, you'll earn $80,000.

(Yes, some authors have already earned much more than that on Leanpub.)

In fact, authors have earnedover $14 millionwriting, publishing and selling on Leanpub.

Learn more about writing on Leanpub

Free Updates. DRM Free.

If you buy a Leanpub book, you get free updates for as long as the author updates the book! Many authors use Leanpub to publish their books in-progress, while they are writing them. All readers get free updates, regardless of when they bought the book or how much they paid (including free).

Most Leanpub books are available in PDF (for computers) and EPUB (for phones, tablets and Kindle). The formats that a book includes are shown at the top right corner of this page.

Finally, Leanpub books don't have any DRM copy-protection nonsense, so you can easily read them on any supported device.

Learn more about Leanpub's ebook formats and where to read them

Write and Publish on Leanpub

You can use Leanpub to easily write, publish and sell in-progress and completed ebooks and online courses!

Leanpub is a powerful platform for serious authors, combining a simple, elegant writing and publishing workflow with a store focused on selling in-progress ebooks.

Leanpub is a magical typewriter for authors: just write in plain text, and to publish your ebook, just click a button. (Or, if you are producing your ebook your own way, you can even upload your own PDF and/or EPUB files and then publish with one click!) It really is that easy.

Learn more about writing on Leanpub