This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2018-02-17
Channels
- # beginners (106)
- # cider (20)
- # cljs-dev (4)
- # cljsrn (1)
- # clojure (65)
- # clojure-austin (7)
- # clojure-canada (2)
- # clojure-russia (1)
- # clojure-spec (28)
- # clojure-uk (2)
- # clojurebridge (1)
- # clojurescript (32)
- # datomic (8)
- # docs (1)
- # emacs (27)
- # events (7)
- # fulcro (13)
- # garden (1)
- # hoplon (3)
- # leiningen (4)
- # luminus (2)
- # off-topic (32)
- # onyx (4)
- # parinfer (6)
- # pedestal (16)
- # re-frame (7)
- # reagent (5)
- # shadow-cljs (8)
- # spacemacs (2)
- # uncomplicate (4)
- # vim (3)
I'm using react-bootstrap-table and I'd like to translate this:
<BootstrapTable data={ jobs }>
<TableHeaderColumn dataField='id' isKey>Job ID</TableHeaderColumn>
<TableHeaderColumn dataField='name'>Job Name</TableHeaderColumn>
<TableHeaderColumn dataField='active' dataFormat={ activeFormatter }>Active</TableHeaderColumn>
</BootstrapTable>
from: https://allenfang.github.io/react-bootstrap-table/example.html#column-format
into cljs.
I'm getting as far as:
[:> js/BootstrapTable {:data jobs}
[:> js/TableHeaderColumn {:dataField "id" :isKey true} Job ID]
[:> js/TableHeaderColumn {:dataField "name"} Job Name]
[:> js/TableHeaderColumn {:dataField "active" :dataFormat ???} Active]
]
I can't seem to get that function right.if I use a plain function, it renders the result of that function as a string
if I do:
(defn activeFormatter [cell]
(reagent.core/reactify-component [active-format cell]))
this is the result:
function (props, context, updater) { // This constructor gets overridden by mocks. The argument is used // by mocks to assert on what gets mounted. if ("development" !== 'production') { "development" !== 'production' ? warning(this instanceof Constructor, 'Something is calling a React component directly. Use a factory or ' + 'JSX instead. See: : void 0; } // Wire up auto-binding if (this.__reactAutoBindPairs.length) { bindAutoBindMethods(this); } this.props = props; this.context = context; this.refs = emptyObject; this.updater = updater || ReactNoopUpdateQueue; this.state = null; // ReactClasses doesn't have constructors. Instead, they use the // getInitialState and componentWillMount methods for initialization. var initialState = this.getInitialState ? this.getInitialState() : null; if ("development" !== 'production') { // We allow auto-mocks to proceed as if they're returning null. if (initialState === undefined && this.getInitialState._isMockFunction) { // This is probably bad practice. Consider warning here and // deprecating this convenience. initialState = null; } } _invariant(typeof initialState === 'object' && !Array.isArray(initialState), '%s.getInitialState(): must return an object or null', Constructor.displayName || 'ReactCompositeComponent'); this.state = initialState; }
(the function itself stringified)what am I missing?
ok, got it... I need reagent.core/as-element
, not reagent.core/reactify-component
😛