Fork me on GitHub
#clojurescript
<
2021-07-30
>
Takis_00:07:03

Hello i try to use (load-file myfile) myfile contents is just (let [a 1] a)

Karol Wójcik11:07:50

You cannot use load-file with Clojurescript AFAIK

Takis_11:07:04

thank you for your reply i saw that, and i try to run repl from my project

Richard Bowen22:07:34

How does one 'destructure' to a map, i.e. the equivalent of the JavaScript {...props} where the data from props would populate the map for the following ClojureScript: [icon {}]

javi23:07:27

most probably you are looking for merge

(let [defaults {:width 20 :height 20}]
         [icon (merge {:color “red”} defaults)])
merge is right to left. and it is shallow. if you need deep-merge there are a few implementations around.

👍 2
jjttjj23:07:29

(let [{:keys [a b c] :as x} {:a 1 :b 2 :c 3}]
  (println "a" a)
  (println "b" b)
  (println "c" c)
  (println "x" x)
  )

a 1
b 2
c 3
x {:a 1, :b 2, :c 3}
This is an example of clojure destructuring, though javi might be right and I misunderstood)

Richard Bowen13:08:55

Basically I'm trying to create a component that passes its props to the component it wraps. Like this:

const AntTabs = withStyles({
  root: {
    borderBottom: '1px solid #e8e8e8',
  },
  indicator: {
    backgroundColor: '#1890ff',
  },
})(Tabs);

const AntTab = withStyles((theme) => ({
  root: {
    textTransform: 'none',
    minWidth: 72,
    fontWeight: theme.typography.fontWeightRegular,
    marginRight: theme.spacing(4),
    fontFamily: [
      '-apple-system',
      'BlinkMacSystemFont',
      '"Segoe UI"',
      'Roboto',
      '"Helvetica Neue"',
      'Arial',
      'sans-serif',
      '"Apple Color Emoji"',
      '"Segoe UI Emoji"',
      '"Segoe UI Symbol"',
    ].join(','),
    '&:hover': {
      color: '#40a9ff',
      opacity: 1,
    },
    '&$selected': {
      color: '#1890ff',
      fontWeight: theme.typography.fontWeightMedium,
    },
    '&:focus': {
      color: '#40a9ff',
    },
  },
  selected: {},
}))((props) => <Tab disableRipple {...props} />);

John Bradens23:07:35

I'm a beginner using shadow-cljs. I'm getting a message "Stale Output! Your loaded JS was not produced by the running shadow-cljs instance. Is the watch for this build running?" I am running "shadow-cljs watch app" in the terminal. I'm also running "lein run" in another terminal, or else the localhost webpage doesn't load (is that the correct way to do things?). What can I do to figure out why this message is coming up?

John Bradens23:07:45

When I run "shadow-cljs compile app", the terminal says "Build completed" but in localhost I get the message "shadow-cljs - Reconnecting..."