Understanding higher-order components

  • Why use HOC: Promote reuse of logic across React components.
  • How to use HOC: The core structure of a HOC is a function that takes a component and returns a new component.
  • HOC are pure functions with no side-effects because the component passed in, is wrapped in a new component.
  • The HOC looks like this: – – State now has a property to inject data from the API fetch into the wrapped component via the prop.
  • React Redux connect has a different function signature of a function returning a function which accepts one argument (ie, ‘component’) to create a HOC.

Understand why and how to use higher-order components with React JS

Continue reading “Understanding higher-order components”

JavaScript Weekend List #10 – Alex Bachuk – Medium

JavaScript Weekend List #10  #webdevelopment #react #javascript #nodejs #graphql #reactjs

  • JavaScript Weekend List #10This week I had a chance to dive deeper into GraphQL.
  • I discovered some new tools and now I’m convinced GraphQL is the new way to build APIs.
  • After reading more about Go, Python, Java and other languages I now realize GraphQL is the way to go.
  • I’ll report back how it goes.Here are some interesting projects and articles for the past week:Login-With project.
  • Forms in React, without tears (I hope it’s true)Experimenting with the background fetch APIDeploying Node and Mongo Containers on AWS EC2Tutorial: GraphQL Subscriptions with Apollo Client

This week I had a chance to dive deeper into GraphQL. I discovered some new tools and now I’m convinced GraphQL is the new way to build APIs. My goal is to prototype few APIs in the next few weeks…
Continue reading “JavaScript Weekend List #10 – Alex Bachuk – Medium”

Testing Common Redux Patterns in React Using AVA

Testing common #Redux patterns in #ReactJS using AVA:

  • Let’s configure the Redux store using our root reducer.
  • As the second argument, we are passing the action which toggles the state of the todo with the given id .
  • When dispatched, the action will cause a todo item of a given id to switch its state, for instance from completed to not completed.
  • /actions’ ; const store = configureStore ({ todos : [ { id : 0 , completed : false , text : ‘buy milk’ }, { id : 1 , completed : false , text : ‘walk the dog’ }, { id : 2 , completed : false , text : ‘study’ } ] }); store .
  • Reducers react to dispatched actions by modifying the store.

This is the second tutorial in our series on testing React and Redux applications.
If you haven’t read the first part, we encourage you to do so.
Continue reading “Testing Common Redux Patterns in React Using AVA”

desklamp

  • To create a nested route (like /home/homey ), simply nest the component inside of the component within and your route will be created .
  • Container gives you the container component with all the application state.
  • The function call returns the current state object.
  • Desklamp allows you to keep your state in a single state object.
  • // Child components become your routable urls

clean routing and state container for react
Continue reading “desklamp”

How to use Immutable.js Records with React and Redux — Azendoo Team — Medium

How to use Immutable.js Records with #ReactJS and Redux

  • We can create a container to present our data and connect it to our application state.
  • export a clear type for each model;
  • As we continue to improve our app, we struggled with the lack of consistency in our models, even if they were immutable.
  • If we mess up with the TaskListItem component, a clear message will pop up in our console.

Read the full article, click here.


@ReactiveConf: “How to use Immutable.js Records with #ReactJS and Redux”


It’s the small things that change your product. React and Flux can be small things, but using them has changed our product like we could…


How to use Immutable.js Records with React and Redux — Azendoo Team — Medium