react-router-bootstrap icon indicating copy to clipboard operation
react-router-bootstrap copied to clipboard

LinkContainer on Pager.Item unknown prop active

Open dmason30 opened this issue 9 years ago • 8 comments

Take this example for bootstrap pager:

        <Pager>
            {previous &&
            <LinkContainer to={{ pathname: 'example/list', query: { page: (current_page-1) }}} >
                <Pager.Item previous href="#">&larr; Previous Page</Pager.Item>
            </LinkContainer>
            }

            {next &&
            <LinkContainer to={{ pathname: 'example/list', query: { page: (current_page+1) }}} >
                <Pager.Item next href="#">Next Page &rarr;</Pager.Item>
            </LinkContainer>
            }
        </Pager>

I get the below warning:

Warning: Unknown prop `active` on <a> tag. Remove this prop from the element. For details, see https://fb.me/react-unknown-prop
    in a (created by SafeAnchor)
    in SafeAnchor (created by PagerItem)
    in li (created by PagerItem)
    in PagerItem (created by OrdersListComponent)
    in LinkContainer (created by OrdersListComponent)
    in ul (created by Pager)
    in Pager (created by OrdersListComponent)

dmason30 avatar Oct 07 '16 14:10 dmason30

I believe this is an issue with react-bootstrap, not react-router-bootstrap. I filed an issue.

godmar avatar Oct 26 '16 01:10 godmar

We should have an activePropName prop on <LinkContainer>. If this is unset, then we can avoid passing down an active prop.

taion avatar Oct 26 '16 02:10 taion

Hi taion

I see the same problem for

<LinkContainer>
    <Thumbnail/>
</LinkContainer>

TrejGun avatar Nov 29 '16 10:11 TrejGun

Same here. Is there a possible workaround? For now my links acquire the active class only if the page is reloaded, if the user switches from one page to another, the navbar links do not change their active state.

RamonBeast avatar Dec 05 '16 13:12 RamonBeast

See my workaround

godmar avatar Dec 05 '16 13:12 godmar

Not getting the error as mentioned but the active item is not changing for my <Nav> component unless I refresh the page

baebb avatar Feb 27 '17 07:02 baebb

Same here, did you try @godmar workaround?

RamonBeast avatar Apr 13 '17 16:04 RamonBeast

After upgrade of react to 15.6 version I get the same error

ventskus-roman avatar Aug 30 '17 10:08 ventskus-roman