question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Containers? Yay/nay?

See original GitHub issue

I hacked up a container mixin: https://github.com/Pyrolistical/hyperapp-container

Usage: https://github.com/Pyrolistical/hyperapp-container/blob/master/example/application.jsx

I took the classic counter example and created a new <Counter /> component and then created 2 instances of it. Each counter holds its own state. I even demo both how parents can push data down to containers using props and how children can send data back up.

The main goal of this project is being able to pull counter into its own file.

You can see the final result in this screen cap: ezgif-4-5e0d96041f

The dirty mixin hack: https://github.com/Pyrolistical/hyperapp-container/blob/master/index.js

All the mixin does is store the state and actions onto the application. I used a dirty hack and require an id for all containers so I know how many instances of state to create.

What does everything think? Do we like the idea of breaking down the application state into a tree of stateful containers and stateless components as leaf nodes?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
Pyrolisticalcommented, Oct 7, 2017

ah ha, state slices solve this problem

1reaction
naugturcommented, Jul 12, 2017

While it’s clean to use and works via a single reference to container, it’s still stateful components and if you ask me I wouldn’t want to use it in an app I’d later have to support. State in components is sometimes a simpler solution in react+redux (feels bad anyway) but with close to no boilerplate in hyperapp, I don’t believe I’d ever need to encapsulate state here and there.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Containers? Yay/nay? · Issue #294 · jorgebucaran/hyperapp · GitHub
I used a dirty hack and require an id for all containers so I know how many instances of state to create. What...
Read more >
Jenkins CICD Getting started with Groovy and Docker ...
This blog is a continuation of part 1 where I describe how to get the Jenkins master container configured. The first step is...
Read more >
YAYNAY: Barr Cosmetics Full Routine [21, Oily Skin] - Hikoco
Overall: This was a nice addition in my skincare routine for the past 4 weeks. The packaging made it easy to see how...
Read more >
CandyKeys - Official Store on Instagram: “Could be a potential GMK ...
What is your vote? Yay/Nay? We hope to see the future behold…” ... CandyKeys Containers for Switches - just about perfect for around...
Read more >
Pin on Wines (Yay, Nay, So-So)
Maple River Winery proudly produces traditional fruit and honey wines with North Dakota grown products at our boutique winery in historic downtown Casselton ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found