This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-08-03
Channels
- # arachne (1)
- # beginners (75)
- # calva (7)
- # cider (1)
- # clj-kondo (6)
- # cljdoc (3)
- # clojure (74)
- # clojure-brasil (2)
- # clojure-china (6)
- # clojure-italy (16)
- # clojure-nl (1)
- # clojure-spec (23)
- # clojure-uk (5)
- # clojurebridge (1)
- # clojuredesign-podcast (8)
- # clojurescript (4)
- # community-development (1)
- # data-science (1)
- # datavis (1)
- # datomic (5)
- # duct (18)
- # graalvm (2)
- # kaocha (3)
- # onyx (3)
- # other-languages (1)
- # pathom (4)
- # reagent (61)
- # reitit (5)
- # shadow-cljs (8)
- # tools-deps (11)
- # vim (1)
figwheel: cljsbuild/dev/compiler { :npm-deps {:react “16.8.6” :react-dom “16.8.6" :react-window “1.8.5”} :install-deps true}
I think it can be used, but this is not the point. I think the root of the error is figwheel npm package support problem.
i dont' usually use figwheels buildin npm setup, i think it's still sorda expermandal use figwheel along with webpack works great for me
module.exports = {
entry: './src/js/index.js',
output: {
filename: 'index.bundle.js'
}
}
import React from 'react';
import ReactDOM from 'react-dom';
window.React = React;
window.ReactDOM = ReactDOM;
{:main hell-world.core
:npm-deps false
:infer-externs true
:foreign-libs [{:file "dist/index.bundle.js"
:provides ["react" "react-dom"]
:global-exports {react React
react-dom ReactDOM}}]}
@barikoi I create ClojureScript + Webpack project https://github.com/chanshunli/hello-webpack-cljs, flow this document https://clojurescript.org/guides/webpack .
https://github.com/chanshunli/hello-webpack-cljs/blob/master/src/cljs/hello_webpack/core.cljs
Where is Row defined?
Or a listener on the resize event
Dispatching the height and width
https://github.com/district0x/re-frame-window-fx/blob/664c1e37aaef1b292d6ce42dcac2255fddc0a1bd/src/district0x/re_frame/window_fx.cljs#L34-L39 Here's example from googling
So, in order to get something similar to what you mentioned above, you need to create an effect, setup it and then it will start sending you the events. The event handler should put data somewhere in your db.
Then you shold subscribe to this data in some component, you could call it auto-sizer
, and then this component could pass the width and height into its children. I'd prefer to use data in place, instead of adding another component, there will be not so much difference.
or
(let [w @(rf/subscribe [:window/width])
h @(rf/subscribe [:window/height])]
[:<>
[x w h] [y w h] [z w h]])
In case of reagent you will need to create an component that will handle all of this
(ns some-ns
(:require [reagent.core :as r]
[goog.events :as events])
(defn auto-size [& children]
(r/with-let [size (r/atom nil)
handler #(reset! size {:width js/window.innerWidth :height js/window.innerWidth})
_ (.addEventListener js/window events/EventType.RESIZE handler)]
(into
[:<>]
(map put-a-size-in-child children))
(finally (.removeEventListener js/window events/EventType.RESIZE handler))))