react-bootstrap / react-router-bootstrap

Integration between React Router and React-Bootstrap
Apache License 2.0
1.69k stars 158 forks source link

LinkContainer on Pager.Item unknown prop active #185

Open dmason30 opened 8 years ago

dmason30 commented 8 years ago

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)
godmar commented 8 years ago

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

taion commented 8 years ago

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

TrejGun commented 7 years ago

Hi taion

I see the same problem for

<LinkContainer>
    <Thumbnail/>
</LinkContainer>
RamonBeast commented 7 years ago

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.

godmar commented 7 years ago

See my workaround

baebb commented 7 years ago

Not getting the error as mentioned but the active item is not changing for my

RamonBeast commented 7 years ago

Same here, did you try @godmar workaround?

ventskus-roman commented 7 years ago

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