Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

example with this.props.attrs? #52

Closed
odoremieux opened this issue May 3, 2018 · 5 comments
Closed

example with this.props.attrs? #52

odoremieux opened this issue May 3, 2018 · 5 comments
Labels

Comments

@odoremieux
Copy link

An example with this.props.attrs would be awesome.
How are you using the WP object with JSX?
Are you using propTypes? If yes how?

@elegantthemes elegantthemes deleted a comment from etstaging May 3, 2018
@lots0logs
Copy link
Member

An example with this.props.attrs would be awesome.

I'm not sure what you mean? 3P Modules do not have access to this.props.attrs because its contents is hoisted up into this.props.

How are you using the WP object with JSX?

Could you provide more details? What is it exactly you are wondering how to accomplish?

How are you using the WP object with JSX?

Yes and no. We do use them but not consistently. We've found that they don't make much of an impact on our development workflow. More often than not they are a chore.

@odoremieux
Copy link
Author

In several places in bundle.js there is
this.props.attrs.module_class
this.props.attrs.text_orientation
this.props.attrs.module_id
this.props.attrs.admin_label
this.props.attrs.title
this.props.attrs.content

so I'm wondering how you assign attrs to this.props

@lots0logs
Copy link
Member

I see. Well, as I explained above, that is not exposed to 3rd party modules. All the attrs are available to you under this.props.

@odoremieux
Copy link
Author

So how are you getting the page title or permalink from a page_id in JSX?
Like the equivalent of get_the_title($page_id), get_permalink($page_id) ?

@lots0logs
Copy link
Member

We send that data down when the builder loads using wp_localize_script(). We're planning to expose that data via the API as part of addressing #23

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants