Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

LinkContainer to={..} does not read state variable #264

Open
@eugeneborodkin

Description

Could someone help me?

I have a state variable as follows,

const [searchParams, setSearchParams] = useState(null);

If I have the following reference to it directly via href (let's say from a Bootstrap-React Dropdown component), I verify that it works, and the URL is correct:

<Dropdown.Menu>
 <Dropdown.Item href={"/viewAgreementForm&searchParams" + searchParams}>View</Dropdown.Item> 
</Dropdown.Menu>

But as soon as I add a LinkContainer around the Dropdown Item with a to={..}, it no longer reads the latest state variable. The value is NULL (perhaps from initialization).

 <Dropdown.Menu>
 <LinkContainer to={"/viewAgreementForm&searchParams=" + searchParams}>
 <Dropdown.Item>View</Dropdown.Item>
 </LinkContainer>
 </Dropdown.Menu>

I get ...&searchParams=null

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /