This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-09-08
Channels
- # announcements (32)
- # aws (2)
- # babashka (21)
- # beginners (143)
- # cider (3)
- # cljsrn (13)
- # clojure (65)
- # clojure-dev (7)
- # clojure-europe (20)
- # clojure-losangeles (8)
- # clojure-nl (13)
- # clojure-norway (39)
- # clojure-uk (9)
- # clojurescript (39)
- # code-reviews (10)
- # conjure (2)
- # cursive (3)
- # datascript (6)
- # datomic (40)
- # events (5)
- # exercism (23)
- # fulcro (9)
- # funcool (2)
- # girouette (2)
- # graphql (4)
- # helix (8)
- # improve-getting-started (4)
- # integrant (7)
- # introduce-yourself (5)
- # jobs (3)
- # luminus (32)
- # malli (3)
- # off-topic (10)
- # pathom (9)
- # pedestal (4)
- # polylith (25)
- # practicalli (1)
- # re-frame (4)
- # sci (3)
- # shadow-cljs (5)
- # tools-deps (25)
- # vim (31)
- # xtdb (32)
I’m trying to get storybook working with a react-native app that I have set up with Krell. I have storybook up and running and I have the app up and running, but I think what I need to do next is add StorybookUIRoot
into my app, but I’m not sure how to do that. My main problem is I don’t know how to import a JavaScript module from my Clojurescript code. I’m trying js/require
but it doesn’t seem to work the way I expect.
There’s a storybook
directory in the root of my project, and this is the code for my app:
(ns react-native-client.core
(:require [reagent.core :as r]
[reagent.react-native :as rn]))
(def StorybookUIRoot (js/require "../../storybook"))
(defn hello []
[rn/view {:style {:flex 1 :align-items "center" :justify-content "center"}}
[rn/text {:style {:font-size 30}} "Hello Lift Buddy!"]])
(defn ^:export -main [& args]
(r/as-element [StorybookUIRoot]))
Krell is designed to just leverage Metro and node_modules
through ClojureScript support for bundlers
Whatever the docs are for StorybookUIRoot
you should be able to replicate it in ClojureScript
that said there may be peculiarities about Storybook here that I don't understand - I've never actually tried to do this myself
Yeah, so the tutorial I’m following here: https://storybook.js.org/tutorials/intro-to-storybook/react-native/en/get-started/ says to import StorybookUIRoot from ‘../storybook’
(excuse the quotes, I’m on my phone), so that’s what I’m trying to replicate. I thought js/require
would be the way to do that. I’ve looked for other docs about how to do that generally in ClojureScript but I haven’t had much luck.
@soxley https://clojurescript.org/guides/webpack this may look like it's specific to webpack but it is not