6 Simple ways to speed up your react native app. – codeburst

6 Simple ways to speed up your #reactnative app.  #redux

  • shouldComponentUpdate life-cycle method is used in regular non pure React Component to cancel the re-render by returning false in certain scenarios.Following two code samples do the same thing.class MyComponent extends React.PureComponent { //}class MyComponent extends React.Component { // nextState) { if(this.props.firstProp === nextProps.
  • firstProp this.props.secondProp === nextProps.secondProp) { return false; } return true } //}Both of the above examples can help you save some wasted renders.
  • Having a unique key on every list item, saves react re-rendering it again.class MyComponent extends React.PureComponent { render() { return this.props.data.map((item, i) = { return Text key={item.id}{item.title}/Text }); }}3.
  • Bind early and don’t create functions inside render.Do thisclass MyComponent extends React.PureComponent { constructor(props) { super(props); this.doWork = this.doWork.bind(this); } doWork() { // doing some work here.
  • // this.props.dispatch…. } render() { return Text onPress={this.doWork}Do Some Work/Text } }Don’t do this inside render.Text onPress={ () = this.doWork() }Do Some Work/TextorText onPress={ this.doWork.bind(this) }Do Some Work/TextBecause render is called very often and every time you do any of the two things above, a new function is created.4.

In my previous article I have talked about hacking event loop for improving performance of your app. Your goal is to retain 60 FPS throughout. All of that applies to react or react native app as well…
Continue reading “6 Simple ways to speed up your react native app. – codeburst”

Facebook announces React Fiber, a rewrite of its React framework

.@Facebook announces React Fiber, a rewrite of its #ReactJS framework:  #JavaScript

  • React Fiber

    The idea behind React Fiber, the company tells me, is to take what the company has learned from developing React the first time around and put that into an updated framework that is still fully backwards compatible with existing React-based applications.

  • React Fiber, Facebook tells me, will become the foundation of any future improvements and feature development of the React framework.
  • Relay Modern

    As Facebook also today announced, Relay — the company’s JavaScript framework for building data-driven applications — has also been rewritten with a similar emphasis on performance and extensibility.

  • “Relay Modern retains the best parts of Relay — colocated data and view definitions, declarative data fetching — while also simplifying the API, adding features, improving performance, and reducing the size of the framework,” the team explains in today’s announcement.
  • Facebook says that when its teams switched the Marketplace tab in the Facebook app from Relay to Relay Modern, the time to interaction on Android improved by an average of 900ms.

Facebook has completely rewritten React, its popular JavaScript library for building user interfaces. The company hasn’t previously talked about React Fiber,..
Continue reading “Facebook announces React Fiber, a rewrite of its React framework”

You Might Not Need React – Hacker Noon

You Might Not Need React  #Reactjs #JavaScript

  • You have the limited developers team with their skills and limited time for work.
  • People around want us to use the newest technologies available to us, right after they have been created.
  • We leave off working on our projects not written with React / ES6 / Webpack (or name another new technology) just because it’s not cool that they were written not with it.
  • New technology is not always a good thing.
  • I don’t mean that we don’t have to move on and bring new technologies into the development of our products.

“If you are a front-end developer and you still don’t use React in your projects, you might be a bad front-end developer. You don’t use ES6 either, do you? Too bad for you then. Maybe Webpack? No…
Continue reading “You Might Not Need React – Hacker Noon”

How to avoid refactoring in your first React.js application

How to avoid refactoring in your first #ReactJS app:

  • In the short blog post I will try to point out some pitfalls, which you should take care of if you want to avoid refactoring in your first React.js application.
  • A common pattern is to create several stateless components that just render data, and have a stateful component above them in the hierarchy that passes its state to its children via props.
  • I don’t see any reasons why not using ES6.
  • If we want to change the data of our big grid component, we have to re-initialize our grid as a jQuery object in React using the componentDidUpdate method.
  • Let’s imagine we need a big grid component, which does some complex things with cells.

Popularity of React.js is growing pretty fast and it seems like React became a compact and beautiful way of how to develop your applications. I have worked on a side project and felt like it is right time to try React. During development of my first project in React I had to do several refactorings. In this short blog post I will try to point out some pitfalls, which you should take care of if you want to avoid refactoring in your first React.js application.
Continue reading “How to avoid refactoring in your first React.js application”