I'm unable to use React's server side rendering due to my use of client side libraries such as reqwest. I would like to pass some data to my react components, however. Is there a way to do this?
How do you pass data to react components from express or koa without renderToString?
762 Views Asked by cat dad At
1
There are 1 best solutions below
Related Questions in EXPRESS
- Dokka - skip generating javadoc for default android packages
- Dokka javadoc jar doesn't work with Intellij IDE
- How to document a primary constructor parameter with Kotlin Dokka
- How do you embed runnable sample code in Dokka generated documentation
- Dokka, Kotlin: How to get a DProperty's type? Or, in general, `DType` from `Bound`?
- Problem with dokka CLI - "Exiting Generation: Nothing to document"
- Problems setting up dokka in Maven
- Execution failed for task ':app:dokkaHtml'
- Linking JS stdlib to generated kdoc
- How can I suppress Dokka documentation for specific classes?
Related Questions in REACTJS
- Dokka - skip generating javadoc for default android packages
- Dokka javadoc jar doesn't work with Intellij IDE
- How to document a primary constructor parameter with Kotlin Dokka
- How do you embed runnable sample code in Dokka generated documentation
- Dokka, Kotlin: How to get a DProperty's type? Or, in general, `DType` from `Bound`?
- Problem with dokka CLI - "Exiting Generation: Nothing to document"
- Problems setting up dokka in Maven
- Execution failed for task ':app:dokkaHtml'
- Linking JS stdlib to generated kdoc
- How can I suppress Dokka documentation for specific classes?
Related Questions in KOA
- Dokka - skip generating javadoc for default android packages
- Dokka javadoc jar doesn't work with Intellij IDE
- How to document a primary constructor parameter with Kotlin Dokka
- How do you embed runnable sample code in Dokka generated documentation
- Dokka, Kotlin: How to get a DProperty's type? Or, in general, `DType` from `Bound`?
- Problem with dokka CLI - "Exiting Generation: Nothing to document"
- Problems setting up dokka in Maven
- Execution failed for task ':app:dokkaHtml'
- Linking JS stdlib to generated kdoc
- How can I suppress Dokka documentation for specific classes?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
The easiest way to do this is by having
api-client.js
andapi.js
. In your browserify/webpack config you set up a client side version. For browserify put this in your package.json (feel free to edit and add webpack).The second option is better in my opinion, but more difficult to implement. You create an abstract representation of your API that works like this:
On the server api.js simply calls the correct functions, which all return promises. On the client it returns a promise, makes an ajax request to the server, which calls these functions, and sends back the response, and the api client resolves/rejects its promise.
This allows the api to automatically work, and allows you to do additional things like track unfulfilled promises, and pre-populate state on the client, etc. (see react-async for example).