Ivan Linko’s answer to How good is ReactJS for building e-commerce websites?

  • A common E-commerce website usually comprises a plethora of forms to fill, complex filters, elements, which interact with different APIs, maps, etc.
  • With the help of React you can easily implement all of those features, making it a good option to build highly interactive E-commerce websites.
  • One of the great things about React is that it allows for a rather convenient way of storing and manipulating the state of your app (e.g. filtering through items is a change in the state of the app).
  • What’s more, React comes with a whole bunch of ready-made modules for all occasion, not mentioning that it’s easy to test and scale.
  • We’ve used React in some of our E-commerce projects and it recommended itself as a very mature and versatile technology.

A common E-commerce website usually comprises a plethora of forms to fill, complex filters, elements, which interact with different APIs, maps, etc. With the help of React you can easily implement all of those features, making it a good option to build highly interactive E-commerce websites. One of the great things about React is that it allows for a rather convenient way of storing and manipulating the state of your app (e.g. filtering through items is a change in the state of the app). What’s more, React comes with a whole bunch of ready-made modules for all occasion, not mentioning that it’s easy to test and scale.
Continue reading “Ivan Linko’s answer to How good is ReactJS for building e-commerce websites?”

Optimizing React Performance with Stateless Components — SitePoint

Optimizing React Performance with Stateless Components  #reactjs #javascript

  • First, the Super Basics
    import React, { Component } from ‘react’

    class User extends Component {
    render() {
    const { name, highlighted, userSelected } = this.props
    console.log(‘Hey User is being rendered for’, [name, highlighted])
    return div
    h3
    style={{fontStyle: highlighted ?

  • For example, something like this:
    import React, { Component } from ‘react’

    class Users extends Component {
    constructor(props) {
    super(props)
    this.state = {
    otherData: null,
    users: [{name: ‘John Doe’, highlighted: false}]
    }
    }

    async componentDidMount() {
    try {
    let response = await let data = await response.json()
    this.setState({otherData: data})
    } catch(err) {
    throw err
    }
    }

    toggleUserHighlight(user) {
    this.setState(prevState = {
    users: prevState.users.map(u = {
    if (u.name === user.name) {
    u.highlighted = !

  • import React, { PureComponent } from ‘react’

    class User extends PureComponent {

    render() {
    const { name, highlighted, userSelected } = this.props
    console.log(‘Hey User is being rendered for’, [name, highlighted])
    return div
    h3
    style={{fontStyle: highlighted ?

  • Our first attempt at re-writing it back to a functional component but with recompose.pure looks like this:
    import React from ‘react’
    import { pure } from ‘recompose’

    const User = pure(({ name, highlighted, userSelected }) = {
    console.log(‘Hey User is being rendered for’, [name, highlighted])
    return div
    h3
    style={{fontStyle: highlighted ?

  • ‘italic’ : ‘normal’}}
    onClick={event = {
    userSelected()
    }}{name}/h3
    /div
    })

    export default User

    As you might notice, if you run this, the User component still re-renders even though the props (the name and highlighted keys) don’t change.

Writing inefficient React components can cause them to rerender too often. Peter Bengtsson looks at ways of creating and optimizing stateless components.
Continue reading “Optimizing React Performance with Stateless Components — SitePoint”

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”

Mapping GraphQL types to Swift – Apollo GraphQL

Mapping GraphQL types to Swift 
#js #graphql #reactjs #swift #ios @martijnwalraven

  • Apollo iOS takes advantage of this type information to map responses to Swift types.
  • The type models suffer from the same issue mentioned above: most requests will only contain a subset of the data defined in these types.
  • With GraphQL, the equivalent approach would be to define a model type for every type defined in your schema.
  • With the approach, there would be a Post type containing all fields returned for posts, for example, and JSON results from individual endpoints are parsed into instances of this type.
  • All primitive GraphQL types have a natural mapping to a corresponding Swift type.

We recently released the first version of Apollo iOS, a strongly-typed GraphQL client for Swift apps. I’ve written about bringing GraphQL to iOS before, but in this post I’d like to go into more…
Continue reading “Mapping GraphQL types to Swift – Apollo GraphQL”