Skip to content

Instantly share code, notes, and snippets.

@jjenzz
jjenzz / comp-design-rules.md
Last active May 23, 2025 15:36
comp-design-rules.md

React Component Design

Compound Component Pattern

  • Build custom components using the compound component pattern (like Radix UI).
  • APIs should be declarative, composable, and expose clearly named parts.
  • Favor composition via children over bundling multiple elements into one.

Semantic Markup

  • Use semantic HTML elements (table, tr, dl, ul, li, etc.) for structure.
  • Do not use divs where a semantic element is appropriate (e.g., don’t use div for tables or lists).
@jjenzz
jjenzz / machine.js
Created October 4, 2019 08:30
Generated by XState Viz: https://xstate.js.org/viz
const dismissMachine = Machine(
{
id: 'dismissMachine',
initial: 'load',
context: {
resolutions: [],
selectedRisksCount: 1,
resolutionId: undefined,
reason: undefined,
},
@jjenzz
jjenzz / machine.js
Last active September 29, 2019 16:19
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
@jjenzz
jjenzz / schema.js
Last active June 23, 2018 10:33
I can't seem to figure out where I'm going wrong here. Querying `stats` returns `null` and the resolvers aren't called. Whyyyy? 🙈https://launchpad.graphql.com/w5q78w4zrz
const typeDefs = `
schema {
query: Query
}
type Query {
stats: Stats
}
type Stats {