Fork me on GitHub

I remember seeing a way here to turn a clojurescript var into some string, then calling a function to turn that string back into a reference to the same var. Anyone know how to do this?


How do I write export default in CLJS?


@arohner there's no way to do that directly


For context, I’m trying to use, and they want it


import React from 'react';
import { Button } from '@storybook/react/demo';

export default { title: 'Button' };

export const withText = () => <Button>Hello Button</Button>;

export const withEmoji = () => (
  <Button><span role="img" aria-label="so cool">πŸ˜€ 😎 πŸ‘ πŸ’―</span></Button>


Are there any libraries that abstract mathematical functions in Clojure and ClojureScript so that both work roughly the same? I’m thinking of things like rounding, exponents, logs. For the moment I’m using conditional compilation, Math for ClojureScript and a mixture of Math and clojure.math.numeric-tower for Clojure. But I don’t know how well this will work out.


How are required namespaces/functions used in the macro file? Can I require in cljs library functions or do functions always need to be fully qualified?

David Pham17:09:27

I am not a macro expert, but if I understand them correctly, if you use your macro in a different namespace you might call the wrong function.


If you write a macro using the backtick, e.g. `map will resolve when the symbol is read to clojure.core/map, or whatever map resolves to in the namespace where the macro was defined, and the full namespace qualified version is what actually gets included in the definition of the macro. That makes it straightforward to know that when you call such macros, it will not use a local version of 'map', for example.


You can of course choose to write macros that do use a local version of a name where the macro is invoked, but it is at the choice of the writer of the macro.


And I should add that I am more experienced with macros in Clojure/Java than ClojureScript, so what I said above is accurate for Clojure/Java, but hopefully someone more knowledgeable of ClojureScript macros will correct any mistakes there if it is different.