Giter Club home page Giter Club logo

Comments (7)

tonsky avatar tonsky commented on August 20, 2024

Is there a way to get a list of all sub rum components of a rum component?

No, there’s no standard way. It’s application-specific.

i would like to be able to get the value of the rum element that is mounted on

use rum/defcc instead of rum/defc, you’ll get additional first argument which will be React component. Then just use .findDOMNode to get to the DOM:

(rum/defcc my-component [comp arg1 arg2]
  (let [node (.findDOMNode comp)]
    ...))

from rum.

gmp26 avatar gmp26 commented on August 20, 2024

Does the solution above work? I'm seeing this on the original and a variant that matches what I understand from the React API for .findDOMNode:

(rum/defcc my-component [comp arg1 arg2]
  (let [node (.findDOMNode comp)]
    [:div]))
; "fails with: Uncaught TypeError: comp.findDOMNode is not a function"

(rum/defcc my-component [comp arg1 arg2]
  (let [node (.findDOMNode js/React comp)]
    [:div]))
;  "fails with: Invariant Violation: findComponentRoot(...): Unable to find element.  This probably means the DOM was unexpectedly mutated ..."

from rum.

tonsky avatar tonsky commented on August 20, 2024

It’s (js/React.findDOMNode comp), sorry about the mistake

from rum.

gmp26 avatar gmp26 commented on August 20, 2024

Thanks - I'm probably missing something - but (js/React.findDOMNode comp) gives me the same error as (.findDOMNode js/React comp).

Could it be that .findDOMNode is being called before the element is created, so triggering an Invariant Violation?

from rum.

tonsky avatar tonsky commented on August 20, 2024

Yes, you should not probably call it during the initial render

On Fri, Nov 13, 2015 at 3:40 PM Mike Pearson [email protected]
wrote:

Thanks - I'm probably missing something - but (js/React.findDOMNode comp)
gives me the same error as `(.findDOMNode js/React comp).

Could it be that .findDOMNode is being called before the element is
created, so triggering an Invariant Violation?


Reply to this email directly or view it on GitHub
#48 (comment).

from rum.

gmp26 avatar gmp26 commented on August 20, 2024

OK, thanks. Rum is really neat BTW :)

from rum.

featheredtoast avatar featheredtoast commented on August 20, 2024

For the wayward traveler finding this issue now (react 15.1+) per this SO post it's now (js/ReactDOM.findDOMNode comp)

React.findDOMNode
has been deprecated, use

ReactDOM.findDOMNode
in React 15.1 and up

https://facebook.github.io/react/docs/react-dom.html

from rum.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.