diff --git a/README.md b/README.md index dbdc69e..170b055 100644 --- a/README.md +++ b/README.md @@ -44,20 +44,34 @@ fn main() { ## What is the "entryPoint"? -The `entryPoint` is the function that returns an object with one or more properties that are functions that when called return the rendered result. +The `entryPoint` could be either: +- the function that returns an object with one or more properties that are functions that when called return the rendered result +- the object itself with one or more properties that are functions that when called return the rendered result -In case the bundled JS is an IIFE the `entryPoint` is an empty string. +In case the bundled JS is an IIFE or the plain object the `entryPoint` is an empty string. ```javascript // IIFE example | bundle.js -> See vite-react example (() => ({ renderToStringFn: (props) => "" }))() // The entryPoint is an empty string ``` +```javascript +// Plain object example | bundle.js +({renderToStringFn: (props) => ""}); // The entryPoint is an empty string +``` + +```javascript +// IIFE varible example | bundle.js -> See webpack-react example +var SSR = (() => ({renderToStringFn: (props) => ""}))() // SSR is the entry point +``` + ```javascript // Varible example | bundle.js -> See webpack-react example -var SSR = () => ({renderToStringFn: (props) => ""}) // SSR is the entry point +var SSR = {renderToStringFn: (props) => ""}; // SSR is the entry point ``` +> The exports results are managed by the bundler directly. + ## Example with initial props ```rust diff --git a/src/lib.rs b/src/lib.rs index f064bfd..9872c5a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -38,19 +38,35 @@ //! } //! ``` //! ## What is the "entryPoint"? -//! The `entryPoint` is the function that returns an object with one or more properties that are functions that when called return the rendered result. -//! In case the bundled JS is an IIFE the `entryPoint` is an empty string. - +//! +//! The `entryPoint` could be either: +//! - the function that returns an object with one or more properties that are functions that when called return the rendered result +//! - the object itself with one or more properties that are functions that when called return the rendered result +//! +//! In case the bundled JS is an IIFE or the plain object the `entryPoint` is an empty string. +//! //! ```javascript //! // IIFE example | bundle.js -> See vite-react example //! (() => ({ renderToStringFn: (props) => "" }))() // The entryPoint is an empty string //! ``` +//! ```javascript +//! // Plain object example | bundle.js +//! ({renderToStringFn: (props) => ""}); // The entryPoint is an empty string +//! ``` + +//! ```javascript +//! // IIFE varible example | bundle.js -> See webpack-react example +//! var SSR = (() => ({renderToStringFn: (props) => ""}))() // SSR is the entry point +//! ``` + //! ```javascript //! // Varible example | bundle.js -> See webpack-react example -//! var SSR = () => ({renderToStringFn: (props) => ""}) // SSR is the entry point +//! var SSR = {renderToStringFn: (props) => ""}; // SSR is the entry point //! ``` //! +//! > The exports results are managed by the bundler directly. +//! //! # Example with initial props //! //! ```no_run