Skip to content

Commit

Permalink
Update Readme.
Browse files Browse the repository at this point in the history
  • Loading branch information
miina committed Apr 6, 2018
1 parent 4c3129b commit 3c60d4b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion components/server-side-render/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
ServerSideRender
=======

ServerSideRender component is used for server-side rendering preview in Gutenberg editor, specifically for dynamic blocks. Server-side rendering in a block's `edit` function should be limited for blocks which are heavily dependent on (existing) PHP rendering logic that is heavily intertwined with data, such as when there are no endpoints available.
ServerSideRender component is used for server-side rendering preview in Gutenberg editor, specifically for dynamic blocks. Server-side rendering in a block's `edit` function should be mostly limited for blocks which are heavily dependent on (existing) PHP rendering logic that is heavily intertwined with data, such as when there are no endpoints available.

Usage of ServerSideRender component could also be justified in the following two cases:
* Lack of potential to take some existing widget-like functionality and improve its user-facing editing experience.
* Unwillingness to create a full JS experience for a block considered legacy.

Note that ServerSideRender should be regarded as a fallback.

New blocks should be built in conjunction with any necessary REST API endpoints so that JavaScript can be used for rendering client-side in the `edit` function for the best user experience, instead of relying on using the PHP `render_callback`. The logic necessary for rendering should be included in the endpoint so that both the client-side JS and server-side PHP logic should require a mininal amount of differences.

Expand Down

0 comments on commit 3c60d4b

Please sign in to comment.