React multi scene , scene with multiple components

Iā€™m creating a project using the muti scene react method of changing from scene to scene without reloading the page.

I have added a new scene but Iā€™d like to attach two components, but when I try it doesnā€™t work.

I tried as an array

components={[recenterButtonComponents, treeComponents]}

Didnā€™t work

I tried just separating them with comma, didnā€™t work.
components={recenterButtonComponents, treeComponents}

I tried adding a second line repeating components
components={recenterButtonComponents}
components={treeComponents}

Here is what my code looks like, Iā€™d like to add multiple components within this statement.

<AFrameScene
sceneHtml={require(ā€˜./tree.htmlā€™)}
components={recenterButtonComponents}
/>

you must use if you want change the the scene or create button to direct to other page

Hi Rama,

I understand I have to use REACT, but my question is how can I add multiple components (the example they give in the tutorial only has one component defined, I would like to add more, but when I add a second component using a comma it doesnā€™t work.

In my example below I have ā€œrecenterButtonComponentsā€ I would like to add a second component called ā€œtreeComponentsā€

components={[
{name:ā€˜exampleā€™, val:recenterbuttonComponents},
{name:ā€˜exampleā€™, val:treeComponents},
]}

1 Like

Thanks Rama,

Iā€™m still just getting my head around doing things the original way and migrating it over to use the React scene switchingā€¦ Nothing like learning on top of learning eh!!

Thanks again.

yess you can use repo on 8thwall github react scene.
so this will be help you, and dont forget learn typescript too for good script haha

BAAAAA I wish I had time for learning another languageā€¦ maybe once i get this project out the door Iā€™ll look more into it.

Spending a lot of time learning intricacies of exporting blender objects and animations as useful glb files, baking keyframes and textures, learning how to export mesh deformations and materials as well.

Itā€™s starting to take shape and itā€™s looking great so far, canā€™t wait for more of this to be baked into my subconscious so I can do more playing then learning.

Hey Ram, thanks for the code, but when I implement it I donā€™t get any errors but those components donā€™t seem to get passed, as my recenter disappears where it was working with just components={recenterButtonComponents}

but once I switched to your method of including multiple components it doesnā€™t crash but I donā€™t see my recenter button so Iā€™m not sure what I have wrongā€¦

components={[

{name:ā€˜recenterā€™, val:recenterButtonComponents},

{name:ā€˜hotspotā€™, val:tapHotspotComponents},

{name:ā€˜closehotspotā€™, val:tapCloseComponents},

]}

can you share the full code?

import {AFrameScene} from ā€˜ā€¦/lib/aframe-componentsā€™
import {FloatingBackButton} from ā€˜ā€¦/lib/material-ui-componentsā€™
import {TreeSceneComponents} from ā€˜ā€¦/components/tree-componentsā€™

import {recenterButtonComponents} from ā€˜ā€¦/components/recenterā€™

import {tapHotspotComponents} from ā€˜ā€¦/components/tap-hotspotā€™
import {tapCloseComponents} from ā€˜ā€¦/components/tap-closeā€™

declare let React: any
declare let ReactRouterDOM: any

const {withRouter} = ReactRouterDOM

const SphereScene = withRouter(({match}) => (
<React.Fragment>

<AFrameScene
sceneHtml={require(ā€˜./kiosk_sphere.htmlā€™)}
components={recenterButtonComponents}
/>
</React.Fragment>
))

export {SphereScene}

**when I replace the components line with what you sent it doesnā€™t workā€¦