Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Guys, can someone enlight me on how to create a react component that encapsulates an Odometer[1] the React Way? Since it does a lot of direct DOM manipulation, I'm not sure of how to do it.

[1] https://github.com/HubSpot/odometer



Typically you would render a single root element and then use the 'after' lifecycle methods (componentDidMount, componentDidUpdate) to grab the root element (with getDOMNode) and make your changes (eg. call a jQuery plugin method on the dom node)

Here's a jsfiddle for the specific lib you're talking about (Odometer): http://jsfiddle.net/p1h7rn3q/


Review the link below for a simple example of a Radial Gauge component. This is just the basic 'wrapping' of an existing UI component so more can be done:

    http://ifandelse.com/using-reactjs-and-kendoui-together/
The JSFiddle example is here:

    http://jsfiddle.net/ifandelse/U5P32/light/




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: