Solid JS Tutorial #17 - Final Touchs & SolidStart Preview

Net Ninja · Beginner ·🌐 Frontend Engineering ·3y ago

Key Takeaways

This video tutorial covers the final touches of a Solid JS project, including adding a message and disabling a button when a product is added to the cart, and also provides a preview of SolidStart, a meta framework for Solid JS.

Full Transcript

All right then gang, so we're reaching the end of the project now, but there's one more thing I want to do and that's to add a little message right here when we click on the add to cart button to say, "Yep, we've just added this product to the cart." And also, maybe I want to disable this button for a second or two when we're adding to the cart so we can't spam click this over and over. So, what we'll do is go to the product component and right here we're adding a product, right? So, it's at this point that I want to do those two things. I want to show the message and maybe the button. Now, to do this we're going to use a signal. So, let me create that signal right about here. So, we'll say const and we'll call this adding and also set adding and we set that equal to use signal. Like so and the initial value for that is going to be false. So, the idea being that this is going to be changed to true when we add a product just for about 2 seconds, okay? So, I need to make sure we're importing use signal or not use signal, sorry. It should be create signal, shouldn't it? Create signal, like so. And that comes from solid js create signal, okay? So, now inside add product, what I could do is I could set adding to be true because we're adding a product and then I will use a set timeout to fire a function and that function is going to fire after 2 seconds, so 2,000 milliseconds. And all we're going to do inside this function is set adding to be false again. So, basically every time we add a product, it becomes true for 2 seconds and then it becomes false again. Okay? So, now we can update the UI down here dependent on that value. So, there's two things I wanted to do like I said. So, first of all, I want to make the button disabled while adding is true for those 2 seconds. So, disabled is equal, oops. Make sure you spell this correctly. My spelling is atrocious at the minute. Disabled equals and it's adding like so. And then after the button, I want to conditionally output some kind of message. So, I only want to show this message when adding is true. Now, to do that we can use the show component. So, let me paste this in and we say show when adding. So, when it's true, after we've just clicked on the button for 2 seconds, we show this div right here with these styles. So, we give it margin, padding, border amber, border two, rounded, inline block and we show the title of the product and we say it was added to the cart. So, this is going to show for 2 seconds next to the button when we click the button, but then when adding becomes false again after 2 seconds, it's not going to show anymore. All right? So, let's cross our fingers, hope this works. I'm going to add to cart and we can see this message right here for 2 seconds. And also, if I click on this, it becomes disabled for 2 seconds as well. You can tell because of the icon. You could style the disabled state a little better if you wanted to, but you can tell because the icon's an arrow while it's disabled and not the pointer. All right? All right then gang, so that's the project pretty much complete and that's also the tutorial series complete as well. There are other features you can add to the site if you want to practice using Solid a little bit more. For example, you could add a delete button next to each item to delete those from the cart or you could add a quantity input on the product details page to let users add more than one of a product at a time. So, definitely try adding those features yourself if you want a bit more practice. But also, I want to show you something really quickly called SolidStart as well. And this is something I really want to make a tutorial about in the future. It's still in alpha at the moment, but when we do get a stable release, I definitely will make a course about it. So, SolidStart is essentially to Solid what Next is to React or what Nuxt is to Vue. It's a meta framework built on top of Solid that implements server-side rendering out of the box, static site generation if that's what you want, component-based routing, API routes, etc. So, it looks really exciting and it's definitely something I'm looking forward to working with a little bit more. And like I said, when we get a stable release, I will hopefully be making a new course all about that as well. So, keep your eyes peeled. So then my friends, I really, really hope you enjoyed this series and you learned something along the way. If you did, please, please, please, don't forget to share, subscribe and like. That really means a lot. And if you want to access all of my YouTube courses without adverts, also get access to premium courses and early access courses as well, you can do at netninja.dev. You can sign up for Net Ninja Pro, which is just $9 a month and also half price for the first month with this promo code right here. And for that, like I said, you get access to every course without adverts, without YouTube adverts. You also get access to exclusive courses not found anywhere else. You get access to my premium courses on Udemy and also early access to all of my YouTube courses as well. So, the link to this page to sign up is going to be down below. Again, I really hope you enjoyed this series and I'm going to see you in the very next one. [Music]

Original Description

🚀🥷🏼Get early access to this entire course now on Net Ninja Pro: https://netninja.dev/p/solid-js-tutorial 📂🥷🏼 Access the course files on GitHub: https://github.com/iamshaunjp/solid-js-tutorial 💻🥷🏼 Modern JavaScript Tutorial: On Net Ninja Pro - https://netninja.dev/p/modern-javascript-from-novice-to-ninja On YouTube - https://www.youtube.com/watch?v=iWOYAxlnaww&list=PL4cUxeGkcC9haFPT7J25Q9GRB_ZkFrQAc 💻🥷🏼 Tailwind CSS Tutorial: On Net Ninja Pro - https://netninja.dev/p/tailwind-css-tutorial On YouTube - https://www.youtube.com/watch?v=bxmDnn7lrnk&list=PL4cUxeGkcC9gpXORlEHjc5bgnIi5HEGhw 🔗🥷🏼 Solid Playground - https://playground.solidjs.com/ 🔗🥷🏼 Solid JS docs (getting started) - https://www.solidjs.com/guides/getting-started 🔗🥷🏼 Solid Router docs - https://github.com/solidjs/solid-router#getting-started 🔗🥷🏼 VS Code - https://code.visualstudio.com/
Watch on YouTube ↗ (saves to browser)
Sign in to unlock AI tutor explanation · ⚡30

Playlist

Uploads from Net Ninja · Net Ninja · 0 of 60

← Previous Next →
1 Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Regular Expressions (RegEx) Tutorial #14 - Matching a Username
Net Ninja
2 Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Regular Expressions (RegEx) Tutorial #15 - Email RegEx Pattern
Net Ninja
3 Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Regular Expressions (RegEx) Tutorial #16 - Finishing Touches
Net Ninja
4 GraphQL Tutorial #1 - Introduction to GraphQL
GraphQL Tutorial #1 - Introduction to GraphQL
Net Ninja
5 GraphQL Tutorial #2 - A Birdseye View of GraphQL
GraphQL Tutorial #2 - A Birdseye View of GraphQL
Net Ninja
6 GraphQL Tutorial #3 - Project (stack) Overview
GraphQL Tutorial #3 - Project (stack) Overview
Net Ninja
7 GraphQL Tutorial #4 - Making Queries (front-end preview)
GraphQL Tutorial #4 - Making Queries (front-end preview)
Net Ninja
8 GraphQL Tutorial #5 - Express App Setup
GraphQL Tutorial #5 - Express App Setup
Net Ninja
9 GraphQL Tutorial #6 - Setting up GraphQL
GraphQL Tutorial #6 - Setting up GraphQL
Net Ninja
10 GraphQL Tutorial #7 - GraphQL Schema
GraphQL Tutorial #7 - GraphQL Schema
Net Ninja
11 GraphQL Tutorial #8 - Root Query
GraphQL Tutorial #8 - Root Query
Net Ninja
12 GraphQL Tutorial #9 - The Resolve Function
GraphQL Tutorial #9 - The Resolve Function
Net Ninja
13 GraphQL Tutorial #10 - Testing Queries in Graphiql
GraphQL Tutorial #10 - Testing Queries in Graphiql
Net Ninja
14 GraphQL Tutorial #11 - GraphQL ID Type
GraphQL Tutorial #11 - GraphQL ID Type
Net Ninja
15 GraphQL Tutorial #12 - Author Type
GraphQL Tutorial #12 - Author Type
Net Ninja
16 GraphQL Tutorial #13 - Type Relations
GraphQL Tutorial #13 - Type Relations
Net Ninja
17 GraphQL Tutorial #14 - GraphQL Lists
GraphQL Tutorial #14 - GraphQL Lists
Net Ninja
18 GraphQL Tutorial #15 - More on Root Queries
GraphQL Tutorial #15 - More on Root Queries
Net Ninja
19 GraphQL Tutorial #16 - Connecting to mLab
GraphQL Tutorial #16 - Connecting to mLab
Net Ninja
20 GraphQL Tutorial #17 - Mongoose Models
GraphQL Tutorial #17 - Mongoose Models
Net Ninja
21 GraphQL Tutorial #18 - Mutations
GraphQL Tutorial #18 - Mutations
Net Ninja
22 GraphQL Tutorial #19 - More on Mutations
GraphQL Tutorial #19 - More on Mutations
Net Ninja
23 GraphQL Tutorial #20 - Updating the Resolve Functions
GraphQL Tutorial #20 - Updating the Resolve Functions
Net Ninja
24 GraphQL Tutorial #21 - GraphQL NonNull
GraphQL Tutorial #21 - GraphQL NonNull
Net Ninja
25 GraphQL Tutorial #22 - Adding a Front-end
GraphQL Tutorial #22 - Adding a Front-end
Net Ninja
26 GraphQL Tutorial #23 - Create React App
GraphQL Tutorial #23 - Create React App
Net Ninja
27 GraphQL Tutorial #24 - Book List Component
GraphQL Tutorial #24 - Book List Component
Net Ninja
28 GraphQL Tutorial #25 - Apollo Client Setup
GraphQL Tutorial #25 - Apollo Client Setup
Net Ninja
29 GraphQL Tutorial #26 - Making Queries from React
GraphQL Tutorial #26 - Making Queries from React
Net Ninja
30 GraphQL Tutorial #27 - Rendering Data in a Component
GraphQL Tutorial #27 - Rendering Data in a Component
Net Ninja
31 GraphQL Tutorial #28 - Add Book Component
GraphQL Tutorial #28 - Add Book Component
Net Ninja
32 GraphQL Tutorial #29 - External Query File
GraphQL Tutorial #29 - External Query File
Net Ninja
33 GraphQL Tutorial #30 - Updating Component State
GraphQL Tutorial #30 - Updating Component State
Net Ninja
34 GraphQL Tutorial #31 - Composing Queries
GraphQL Tutorial #31 - Composing Queries
Net Ninja
35 GraphQL Tutorial #32 - query variables
GraphQL Tutorial #32 - query variables
Net Ninja
36 GraphQL Tutorial #33 - Re-fetching Queries
GraphQL Tutorial #33 - Re-fetching Queries
Net Ninja
37 GraphQL Tutorial #34 - Book Details Component
GraphQL Tutorial #34 - Book Details Component
Net Ninja
38 GraphQL Tutorial #36 - Styling the App
GraphQL Tutorial #36 - Styling the App
Net Ninja
39 GraphQL Tutorial #35 - Making a Single Query
GraphQL Tutorial #35 - Making a Single Query
Net Ninja
40 Build Apps with Vue & Firebase - Udemy Course
Build Apps with Vue & Firebase - Udemy Course
Net Ninja
41 Updated Vue & Firebase Course (Udemy)
Updated Vue & Firebase Course (Udemy)
Net Ninja
42 Vue & Firebase Real-time Chat (Preview) #1 - Intro
Vue & Firebase Real-time Chat (Preview) #1 - Intro
Net Ninja
43 Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Vue & Firebase Real-time Chat (Preview) #2 - Project Structure
Net Ninja
44 Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Vue & Firebase Real-time Chat (Preview) #3 - Firestore Setup
Net Ninja
45 Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Vue & Firebase Real-time Chat (Preview) #4 - Welcome Screen
Net Ninja
46 Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Vue & Firebase Real-time Chat (Preview) #5 - Props in Routes
Net Ninja
47 Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Vue & Firebase Real-time Chat (Preview) #6 - Route Guards
Net Ninja
48 Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Vue & Firebase Real-time Chat (Preview) #7 - Chat Window
Net Ninja
49 Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Vue & Firebase Real-time Chat (Preview) #8 - New Message Component
Net Ninja
50 Object Oriented JavaScript Tutorial #1 - Introduction
Object Oriented JavaScript Tutorial #1 - Introduction
Net Ninja
51 Object Oriented JavaScript Tutorial #2 - Object Literals
Object Oriented JavaScript Tutorial #2 - Object Literals
Net Ninja
52 Object Oriented JavaScript Tutorial #3 - Updating Properties
Object Oriented JavaScript Tutorial #3 - Updating Properties
Net Ninja
53 Object Oriented JavaScript Tutorial #4 - Classes
Object Oriented JavaScript Tutorial #4 - Classes
Net Ninja
54 Object Oriented JavaScript Tutorial #5  - Class Constructors
Object Oriented JavaScript Tutorial #5 - Class Constructors
Net Ninja
55 Object Oriented JavaScript Tutorial #6 - Class Methods
Object Oriented JavaScript Tutorial #6 - Class Methods
Net Ninja
56 Object Oriented JavaScript Tutorial #7 - Method Chaining
Object Oriented JavaScript Tutorial #7 - Method Chaining
Net Ninja
57 Object Oriented JavaScript Tutorial #8 - Class Inheritance
Object Oriented JavaScript Tutorial #8 - Class Inheritance
Net Ninja
58 Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Object Oriented JavaScript Tutorial #9 - Constructors (under the hood)
Net Ninja
59 Object Oriented JavaScript Tutorial #10 - Prototype
Object Oriented JavaScript Tutorial #10 - Prototype
Net Ninja
60 Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Object Oriented JavaScript Tutorial #11 - Prototype Inheritance
Net Ninja

This video tutorial teaches how to add a message and disable a button when a product is added to the cart in a Solid JS project, and also introduces SolidStart, a meta framework for Solid JS. The tutorial covers state management using createSignal and conditional rendering of UI components.

Key Takeaways
  1. Create a signal using createSignal to manage state
  2. Use setTimeout to delay the execution of a function
  3. Conditionally render a UI component based on the state
  4. Disable a button when a product is added to the cart
  5. Explore SolidStart and its features
💡 Using createSignal to manage state and conditional rendering to update the UI can improve the user experience of a Solid JS application.

Related Reads

Up next
How to Speed Up Your WordPress Website with WP Rocket ⚡Tutorial 2026
Matt Tutorials
Watch →