react

A 6-post collection

Embedding discourse comments in a React Single Page App

Discourse provides a simple way to embed a topic's posts in another website as comments. Problem was it didn't work for my React single page app. Here's how I fixed it What Went Wrong The recommendation on discourse site is to use the following code to embed the comments: <div id='discourse-comments'></div> <script type="text/javascript"> DiscourseEmbed = { discourseUrl: 'http://discourse.example.com/', discourseEmbedUrl: 'http://example.com/blog/entry-123.html' }; (function() { var d = document.createElement('script'); d.

Read more

React Form Handling

React doesn't provide a standard method to write forms, and that gap leaves many developers searching for ready-made solutions. Problem is many of the existing solutions feel over engineered or not flexible enough. I think the reason is React apps (and developers) have different viewpoints, and so it's not easy to create a single solution that fits all. Instead it may be better to build your own form components or even multiple sets of form components to fit each part of the application. In this post

Read more

6 React Mistakes I Wish I Hadn't Made

About 4 months into developing my second large React app, I'm already starting to see some of the anti patterns I shouldn't have used in development (and will now have a hard time fixing). With the hope that it'll help you avoid those same mistakes, here they are with the means I should have taken to avoid. Code Duplication Code duplication certainly isn't unique to React, and using React should have helped avoid some duplication (And it did. Occasionally). But splitting a real world design into

Read more