简体   繁体   English

反应SSR和ReactiveSearch

[英]React SSR and ReactiveSearch

If I have a movie search application and am using ReactiveSearch with Elasticsearch. 如果我有电影搜索应用程序,并且正在将ReactiveSearch与Elasticsearch结合使用。 I'd like to integrate Server Side Rendering (SSR) into the app but am trying to make sure I understand implementation first before I start. 我想将Server Side Rendering(SSR)集成到应用程序中,但是在尝试开始之前,请确保我首先了解实现。

I want my Autocomplete component to be the home page of the website and I just want to render the search box as quickly as possible. 我希望“自动完成”组件成为网站的主页,我只想尽快呈现搜索框。 I don't necessarily want to render results within milliseconds of user coming to the page - I just want to show them them content quickly. 我不一定要在用户进入页面后的几毫秒内呈现结果-我只想向他们快速显示内容。

Do I need to implement SSR for ReactiveSearch too? 我也需要为ReactiveSearch实施SSR吗?

OR 要么

Is React SSR enough? React SSR是否足够?

The primary advantage of SSR in ReactiveSearch is the results are pre-fetched on the server and populated in the ReactiveSearch store which renders them instantly as soon as the page is fetched. SSR在ReactiveSearch中的主要优点是,结果是在服务器上预先提取的,并填充在ReactiveSearch存储中,从而在提取页面后立即将其呈现。

If your usecase does not need the results to be server rendered then just SSR for other react components would be fine. 如果您的用例不需要将结果呈现给服务器,则仅将SSR用于其他反应组件就可以了。

Note that when you use SSR for reactivesearch the server takes slighly longer to respond since it has to fetch the data from elasticsearch. 请注意,当您使用SSR进行反应搜索时,服务器需要花费更长的时间才能响应,因为它必须从elasticsearch中获取数据。 So, at times SSR might not be the perfect usecase (especially if you're not interested in server rendering the results). 因此,有时SSR可能不是完美的用例(尤其是如果您对服务器呈现结果不感兴趣的话)。

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

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