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

Mount an Individual View Component #37

Open
sealocal opened this issue Jul 5, 2017 · 2 comments
Open

Mount an Individual View Component #37

sealocal opened this issue Jul 5, 2017 · 2 comments

Comments

@sealocal
Copy link

sealocal commented Jul 5, 2017

Is it possible to mount an individual component? If not, would it be a reasonable feature request?

My current approach is to unmount all components on the page and then mount them again - but, this resets the state of all components on the page - and I even get inconsistent results when I expect all components to reset.

Consider adding an instance of an Item component to a page through an ajax request:

document.getElementById('items')
  .insertAdjacentHTML('beforeend', '<%= j render partial: 'items/item', locals: { item: @item } %>');

WebpackerReact.unmountComponents()
WebpackerReact.mountComponents()

Here's a change to the webpacker-react-example that shows the full request/response in action.
renchap/webpacker-react-example@master...sealocal:add-item-with-remote-request

Please share thoughts on mounting a single component on the page.

@renchap
Copy link
Owner

renchap commented Sep 11, 2017

This should definitely be doable. I will work on implementing this.

@edudepetris
Copy link

@renchap are there any update regarding "mount an individual component"?
Do you have any example about this comment #42 (comment)?

BTW: Amazing work, thx!

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

No branches or pull requests

3 participants