gregrickaby / nextjs-wordpress

💀 It's headless WordPress!

Home Page:https://nextjswp.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Create <WordPressProvider /> Component to House Context

gregrickaby opened this issue · comments

I feel like global-y things like Menus, Settings, SEO, etc... should be managed in a new <WordpressProvider /> component, rather than passed down by every query.

  • Create <WordPressProvider /> component (it should follow this pattern)
  • The Provider should have a useWordPress() hook
  • Add new provider to _app.tsx
  • Create a query for global items like menus, settings, and SEO
  • Place query results into state
  • Use the useWordPress() hook to grab the state and pass into other components like, <Layout />

Because I removed Tailwind, I might as well spin up a provider as part of #26. Less to juggle!

commented

I feel like global-y things like Menus, Settings, SEO, etc... should be managed in a new <WordpressProvider /> component, rather than passed down by every query.

Yeah, I agree, this would be a better solution.