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

Can't switch appRun components by switching in state #97

Closed
vicsnow opened this issue Apr 29, 2020 · 2 comments
Closed

Can't switch appRun components by switching in state #97

vicsnow opened this issue Apr 29, 2020 · 2 comments

Comments

@vicsnow
Copy link

vicsnow commented Apr 29, 2020

Description

Unable to switch between appRun components, using state in main.tsx
While having the ability to switch between a functional and appRun component

I have 3 components:

  • Test1 (appRun component)
  • Test2 (appRun component)
  • Test3 (functional component)

I have 3 buttons that switch state.content

If I press "change to test1" it renders Test1 component, however, if I press "change to test2" it doesn't. But it does re-render tho, when I press "change to test3"

To reproduce

npm && npm start

Click all the buttons and see that it changes only between test1||test2 and test3

Expected behavior

Switch between all three components (Test1, Test2, Test3)

@yysun
Copy link
Owner

yysun commented Apr 29, 2020

Please try to add Ids to Test1 and Test2.

@vicsnow
Copy link
Author

vicsnow commented Apr 29, 2020

Hey, thanks, that did work!

Apparently, I was confused, because adding an "id" inside Test1 and Test2 components
e.g. view = () => <div id="test1">test1</div> did nothing
But adding them at the place of their call
e.g. content=<Test1 id="test1" /> did help

Updated my repo for those, who are interested

@vicsnow vicsnow closed this as completed Apr 29, 2020
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

2 participants