0

I am new to react, first app. I am trying to create a custom element with attributes of data. For the time being I am writing in plain ES5 so no JSX, Babel or ES6 yet. That will be next.

var myEl = React.createClass({
    displayName : 'elCont',
    render: function() {
        return(
            React.createElement('My-Shiney-Element', {
                data: data,
                conf: conf
            })
         );
     )}


var data = [1,2,3,4,5,6];
var conf = {"show": true};

I can see in the html <my-shiney-element><\my-shiney-element> But not the attributes?

1 Answer 1

1

You can use

<my-shiney-element foo="bla"><\my-shiney-element> 

in you code you can access "foo" with "this.props.foo"

https://facebook.github.io/react/docs/transferring-props.html

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.