jxnblk / mdx-go

:zap: Lightning fast MDX-based dev server for progressive documentation
https://mdx-go.now.sh
MIT License
364 stars 27 forks source link

Pagination cause `staticContext` react DOM warning #9

Closed youngboy closed 6 years ago

youngboy commented 6 years ago

Not sure why, after add a new page, dev console have this error message

react-dom.development.js:492 Warning: React does not recognize the `staticContext` prop on a DOM element. If you intentionally want it to appear in the DOM as a custom attribute, spell it as lowercase `staticcontext` instead. If you accidentally passed it from a parent component, remove it from the DOM element.
    in a (created by Link)
    in Link (created by Route)
    in Route (created by NavLink)
    in NavLink
    in Unknown (created by Styled(Component))
    in Styled(Component)
    in div (created by Styled(div))
    in Styled(div)
    in Unknown (created by Route)
    in Route (created by withRouter())
    in withRouter() (created by Root)
    in div (created by Styled(div))
    in Styled(div) (created by Main)
    in div (created by Styled(div))
    in Styled(div) (created by Main)
    in Main (created by Root)
    in div (created by Styled(div))
    in Styled(div) (created by Layout)
    in Layout (created by Root)
    in Root (created by Route)
    in Route (created by withRouter(Root))
    in withRouter(Root) (created by App)
    in MDXProvider (created by App)
    in HeadProvider (created by App)
    in App
    in Router (created by BrowserRouter)
    in BrowserRouter

After removing Pagination from my layout, the error message has gone.

I believe that Pagination component should do the same thing as NavLinks to pull staticContext props, like

Pagination = withRouter(({
  routes = [],
  order = [],
  filter,
  history,
  location,
  match,
  staticContext
  ...props
})