Component Driven?
Start small. Develop components in isolation. Don’t forget to pause & reflect on the code you’ve written. Can it be split into several small components?
✨ When you’re ready, combine your components to create features.
✨ Add the features to a view.
✨ Add the view to your app.
You can read more about Component Driven User Interfaces here.
Storybook
I’ve just begun to use Storybook and currently learning about it. What I especially like so far, is that the tool encourages you to write UI components that are independent … and functional?
This makes it possible to develop user interfaces in isolation. Just pass data and actions as parameters into your components. Keep it simple.
This way of working reminds me a lot of Polylith, an architecture I have used in backend focused Clojure projects and that I enjoy a lot.
ClojureScript & Storybook?
You will find a fully working example in this repo. I have added Storybook to a ClojureScript web app, using shadow-cljs, with additional npm scripts located in package.json.
The code in my GitHub repo is a continuation of the work I’ve described in an earlier post, about combining shadow-cljs with Webpack and AWS Amplify.
No JavaScript quirks?
Well, yeah some. The JavaScript ecosystem is evolving fast, tools are updated with breaking changes and sometimes that causes compatibility issues. In this case it is Storybook and Webpack 5. But I have solved it with a few extra rows of configuration. Don’t worry.
Have a look at the fully working example at GitHub.
Many thanks to Shaolang Ai, that wrote this blog post about shadow-cljs and Storybook that I’ve learned a lot from.
Top photo by Etienne Girardet on Unsplash