I am doing an app where I have some components and I've defined useStates from them, obtaining the values I need from all of them
I've also created a Context with useContext and I wrapped my main component like this:
import React from 'react'
import { AppContext } from './components/appContext/AppContext'
import { MainApp } from './MainApp'
export const App = () => {
const testValues = {
myDomine: 'domine name',
mySpace: 'space name',
color: 'red',
persons: '5 ',
privacidad: true
}
return (
<AppContext.Provider value={testValues}>
<MainApp/>
</AppContext.Provider>
)
}
with the above testValues object I can obtain what I need in other component like this:
const { myDomine, mySpace} = useContext(AppContext)
previously importing useContext and the AppContext I've created beforehand
you see all works fine BUT
How can I pass my components stateValues that I've obtained individually to this testValues object?
Is what I am trying to achieve completly wrong?
thanks in advance