Slide 1

Slide 1 text

Stimulus.js - basics and context of usage 02.2023

Slide 2

Slide 2 text

Agenda (1/7) 1. Context 2. A professional graph, with informations on it 3. Basics 4. Code 5. When to stimulate yourself 6. A goodbye :(

Slide 3

Slide 3 text

What is context? (2/7) ● Saas? ● Greenfield? ● Start-up? Scale-up? ● Internal software? ● 1-2 devs? ● Other teams depends on your work? ● New technology? ● Software with lives at stake? ● New job? Want to show off? ● Deadline ● Juniors in project? ● Growing, expanding, CD ● Paas? ● Legacy? ● Big Enterprise? FAANG? ● Software for client? ● 10 devs? ● Independent from other engineers? ● Prehistoric tech? ● Only business value of software? ● Want to get fired? ● Budget ● Only seniors in project? ● Maintenance

Slide 4

Slide 4 text

Stimulus, when, why? (3/7) Top of the line, we da best developers, bleeding-edgetech Our app is React/Vue first, backend is our bitch “I am a special boy” Full SPA or a big framework is too much I am a Ruby monkey, JS scary, but I want my app to shine I want to hide this div when I click this button and then kill myself I want to get fired and then die Complexity Possibilities

Slide 5

Slide 5 text

Basics (5/7)
foo#laugh” /> //div> //app/javascript/controllers/brug_controller.js import { Controller } from "stimulus"; export default class extends Controller { static targets = ["hehe"]; connect() { console.log(‘brug on’) } laugh() { this.heheTarget.value = “HEHE!!!” } }

Slide 6

Slide 6 text

Code (6/7) 127.0.0.1 No place like

Slide 7

Slide 7 text

When to use vs When not to use (7/7) ● Small/medium FE project ● Lots of CRUD, data-entry app ● Existing Rails app ● Devs are good at Backend ● A lot happens on server-side ● Reactivity on client side is mostly a “sprinkle” ● Refactoring legacy Rails jQuery into stimulus ● Multiple teams on the project ● React/Vue etc. already in the app ● Highly interactive app ● Not the best choice for expanding your JS abilities ● You want to level up on popular technologies ● Shared components/libraries in the app As a sidenote: if you want more reactivity, but NOT as much to justify JS framework like React or Vue, maybe add Turbo

Slide 8

Slide 8 text

Dziękuję za uwagę