Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is is possible to create a hybrid page (combined static and client route) (the app-shell model) rather than a hybrid app (client-only route) #3451

Closed
dominicfallows opened this issue Jan 9, 2018 · 2 comments
Labels
type: question or discussion Issue discussing or asking a question about Gatsby

Comments

@dominicfallows
Copy link
Contributor

dominicfallows commented Jan 9, 2018

I've been working with Gatsby now for a couple of weeks, merging several different React Apps into one Gatsby React app - so far so good - its great and we are already seeing the benefits.

A use case has come up whereby we are looking to have a hybrid page (static and client route). I can see documentation and examples for creating a hybrid app with client-only routes, however, I'm looking at being able to do the following:

A single static and client route that can have:

  • statically generated app shell - that uses a GraphQL query from a Drupal (or any other) source that creates header, menus, sidebars, CSS etc
  • dynamic URL route
  • dynamic content via a client-side API request (React componentDidMount API request)

I'm ploughing on ahead to hopefully get a sample app to test, but thought I would ask here also.

Much thanks in advance.

@dominicfallows dominicfallows changed the title Is is possible to create a hybrid page (static and client route) rather than a hybrid app (client-only route) Is is possible to create a hybrid page (combined static and client route) (the app-shell model) rather than a hybrid app (client-only route) Jan 9, 2018
@dominicfallows
Copy link
Contributor Author

OK so after some testing, it seems that client-only routes do indeed generate both static and dynamic content on those routes.

If you use Gatsby and GraphQL in layouts to create the static app-shell (for example a GraphQL query to create a menu structure, with container divs and CSS etc) and then use React components with componentDidMount API calls to consume dynamic content.

This is perhaps the whole point of Gatsby client-only routes, however this wasn't clear from the documentation. I will do my best to contribute to the docs for other peoples use.

@dominicfallows
Copy link
Contributor Author

Answered by the doc updates on #3579

@fk fk added the type: question or discussion Issue discussing or asking a question about Gatsby label Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: question or discussion Issue discussing or asking a question about Gatsby
Projects
None yet
Development

No branches or pull requests

2 participants