All posts filed under “React

comment 0

Debounce a redux dispatch method in a react component

Tightly connected reactivity in a react application has the side effect that it is sometimes necessary to delay the execution of a method. Assume you have a search input field that filters elements while typing, every field input creates a search request. In order to get rid of unnecessary search requests you have to wait until a user has finished typing and then start the search. To make this work without a search button, you have to intercept repeating executions (debounce) of the search method within a specified time frame and delay the execution of the last call.
Read More

comments 3

Make your Redux React app multilingual

For my current React app in development I’m using Redux to manage the client state. As this is the first time using Redux I’m not quite sure what to put in the store yet. But I’ve decided to give the multilingual labels and wordings a try. Below you’ll find a simple approach on how I made my app multilingual using the Redux client state to store the translated content. I assume you are familiar with Redux and React.
Read More

comments 6

Reactive subscriptions with Apollo and React

Apollo server and client support real-time subscriptions with web sockets. Compared to Meteor’s out of the box real-time communication this is a lot more difficult to set up. With this short tutorial I’ll give you an example of how you can get a simple reactive subscriptions into your Apollo/React app. The idea is that you use real-time communication for a specific case only, f.g. sending notifications. We will accomplish this in five steps.

  1. Install project requirements.
  2. Setup the server schema.
  3. Add server resolvers.
  4. Setup the client subscription.
  5. Modify a component to receive data from a subscription.
    Read More
comment 0

Graphql with Apollo, Meteor and React

For my last project I had to build a web application to administrate a MongoDB database. Due to using Meteor quite a lot I heard about Graphql and the Apollostack. Graphql, which is a specification done by Facebook engineers, promises to be the better REST API (which I hope it is). I became curious and decided the build the server API with Apollo. First I tried to evade using the Meteor as build system as I don’t want to get too accustomed to this full-stack ecosystem. However, building a live-reload server and client build system in ES6 with Node.js, Babel and Webpack was simply too much work compared to building this simple web app. So in result this was my stack:
Read More

comment 0

OLMOTO – An app built by beginners

One month ago I started teaching a friend the basics of JavaScript with Meteor, Mantra and React.
Together we’ve built an app to create and share events with friends. It was an awesome experience. Yesterday we launched a private version on heroku. For us this was a great accomplishment. I learned a lot from this project and thought about sharing it with world.

https://github.com/janikvonrotz/olmoto

Some technical features and challenges we solved:

  • Access control for methods, publications and routing.
  • Mobile first ui with material design.
  • Fulltext search everywhere.
  • File upload to Dropbox with Meteor-Files.
  • Images with different thumbnails.
  • Keyboard navigation in single views.
  • Ready for deployment to heroku.

Thanks to the makers of Meteor, React, Mantra and Mantra-CLI.

comments 2

React image loader with a spinner

hey there, I’ve spent as usual a lot of time with React, Mantra and Meteor. While building a simple app I checked out the new Meteor standard for file handling Meteor-Files. It works great, I really recommend this awesome package. But that’s not what I want to show you. The app I’m working on loads pictures form the dropbox api. Downloading the pictures always takes a while. To make sure the user doesn’t get impatient the app is now displaying a spinner when the image is loading. I would to like to show you how I’ve built this image loader and spinner component.
Read More

comment 0

Meteor and React: Markdown editor with draft.js and marked.js

Recently I switched my current project from Meteor 1.2 to 1.3. While doing so I reworked the code for my markdown editor. When created the markdown editor in the first place I learned about the necessity of a solid platform to build web editors. So this time I used draft.js as base. Facebook open sourced draft.js a few months ago. They use it almost everywhere on Facebook page, so it should be well-tested.

The markdown editor you’re going to build has these features:

  • Instant html preview rendering
  • Support for GitHub flavoured syntax and markdown tables
  • Drag and drop file upload.
  • Copy and paste file upload.

Optionally: File upload with Meteor and FS Collection.
Read More