1

Live Preview: https://www.webpackbin.com/bins/-KoSqF5OB0IRtbBEi822

Im trying to Clone and Modify a React Element Object.

I'm removing the inline styles of react element by cloning and adding css rules to stylesheet

Im using this function

I want to know how can i access the React Render function return value from the Element's Class ?

const Div = () => (<div></div>); // not working
const Div = (<div></div>); // working

const NewDiv = noInline(Div); // calling function

1 Answer 1

1

I believe to do it you need to get a reference to the element in the render function, and that element should be one of the component child elements — so traverse this.props.children and find the element you are looking for. Something like this:

render () {
  let children = React.Children.toArray(this.props.children);
  children.forEach((child) => doSomething(child))
}
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.