简体   繁体   English

将Gatsby.js用于动态和静态Web应用程序

[英]Using Gatsby.js for dynamic and static web apps

I am building a web app for a startup from scratch and have decided to use react and graphQl to query mongodb with nodejs as my backend. 我正在从头构建启动的Web应用程序,并决定使用react和graphQl以nodejs作为后端查询mongodb。

Gatsby.js seems to bundle react, graphql, and even redux with their framework, which is supported with many helpful plugins. Gatsby.js似乎将react,graphql甚至redux与它们的框架捆绑在一起,许多有用的插件都支持该框架。 So it seems like it could dynamically render content on the client side, and its also built for fast static rendering of the site on the client side. 因此,它似乎可以在客户端动态呈现内容,并且还可以在客户端快速静态呈现网站。 Seems perfect for my use case where... 对于我的用例来说似乎是完美的...

Some features of this site would require dynamic AND static rendering of content on the client side... 该网站的某些功能需要在客户端动态和静态呈现内容...

Before investing my time in Gatsby.js I want to know if its possible, or practice to use Gatsby.js for a mix of static and dynamic web rendering. 在将时间投入Gatsby.js之前,我想知道是否有可能,或者练习使用Gatsby.js混合静态和动态Web渲染。 are their better frameworks or solutions? 是更好的框架或解决方案? or will this work? 还是可以的?

Gatsby.js seems to bundle react, graphql, and even redux with their framework, which is supported with many helpful plugins Gatsby.js似乎将react,graphql甚至redux与它们的框架捆绑在一起,许多有用的插件都支持该框架

Gatsby is a framework for React and uses GraphQL/Redux among other things under the hood - you can't use eg Redux out of the box and GraphQL is the data layer to query Gatsby's content, not external APIs. Gatsby是一个用于React的框架,并且在后台使用GraphQL / Redux-您不能开箱即用,例如Redux,而GraphQL是查询Gatsby内容的数据层,而不是外部API。 Hope that clears things up. 希望这能说明问题。

Before investing my time in Gatsby.js I want to know if its possible, or practice to use Gatsby.js for a mix of static and dynamic web rendering. 在将时间投入Gatsby.js之前,我想知道是否有可能,或者练习使用Gatsby.js混合静态和动态Web渲染。

Of course :) That's why Gatsby re-hydrates into a fully functional React app on the client - so that you can fetch additional APIs or do dynamic stuff on top of the rendered HTML. 当然:)这就是为什么盖茨比在客户端上重新水化为功能完备的React应用程序的原因-这样您就可以获取其他API或在呈现的HTML之上进行动态处理。

Might be an interesting read for you: https://www.gatsbyjs.org/blog/2018-11-07-gatsby-for-apps/ 可能对您来说很有趣: https//www.gatsbyjs.org/blog/2018-11-07-gatsby-for-apps/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM