5

I'm trying to adapt a Reagent (using re-frame) program that contains a component I want to be able to use from a plain React program. Essentially I to be able to take a Reagent (re-frame) component like this:

(defn my-component []
  (fn []
    (let [x (re-frame/subcribe [])]
      [:div (:something x)])))

Then, I want to have this render only when invoked from a js file, sort of like:

import myComponent from 'my-component'
class Example extends React.Component {
  render() {
    return (
      <myComponent
       x = "Hi"
       />
    );
  }
}

From all I can piece together it involves using reagent/reactify-component and/or reagent/create-class. But it's not very clear how these come together to make something a JS dev can use.

1 Answer 1

1

Check out reagent.core/as-element, it receives a hiccup vector and returns a react element.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.