sei-ec-remote / team-project-issues

0 stars 0 forks source link

Passing props from one controller to another. Getting the wrong props for some reason #146

Closed tthephas closed 1 year ago

tthephas commented 1 year ago

Describe the bug A clear and concise description of what the bug is. trying to pass some props from "exhibitions" that were jsut created, to the next controller/screen the user will see, so they can finish creating something. but when we pass the props, it seems to be pulling from another index. cannot figure out why or where its coming from

What is the problem you are trying to solve? pass the correct props to this controller

Expected behavior A clear and concise description of what you expected to happen. pass props from a newly created object so that a user can add more items to it

What is the actual behavior? A clear and concise description of what actually happened. no props showing, but the console log actually says its from our "artworks" and not our "exhibitions"

Post any code you think might be relevant (one fenced block per file)

                    <Route
                        path='/exhibitions/add-artworks'
                        element={
                        <RequireAuth user={user}>
                            <AddArtworkToExhibition 
                            msgAlert={msgAlert} 
                            user={user}
                            exhibition={exhibition} />

                        </RequireAuth>
                        }
                    />

const ChooseArtworks = (props) => {
    // const { msgAlert, user } = props
    //console.log('props in home', props)
    const { exhibition } = props
    console.log('this is the prop ', exhibition)

    return (
        <Container className="m-2" style={{textAlign: 'center'}}>
            <h2>Add Artwork to your Exhibition</h2>

            {/* maybe style this with bg image */}
        <Card 
        key={ exhibition.id }
         >
            <Card.Header>
                { exhibition.title  }
                </Card.Header>

What is your best guess as to the source of the problem? we are not sure.

What things have you already tried to solve the problem? we tried bringing them in a few different ways and adding console logs to see what is passed but its the wrong info

Additional context Add any other context about the problem here.

Paste a link to your repository here https://github.com/caitreid/projectThreeFrontend

asands94 commented 1 year ago

Hows this issue going?

tthephas commented 1 year ago

not solved. we are trying to re-write the code using state, within the one form (create exhibiton AND add artwork together). struggling still to figure out.

tthephas commented 1 year ago

timm helped here and we're going to use a subdoc to push the info into and render. should be ok here.