Create a React app with zero configuration using Parcel

Create a React app with zero configuration using Parcel  #ReactJS

  • Create React App was created to make it easier and quicker to get started.
  • The problem with creat react app is that it hides the webpack config.
  • When your app grows and you need something a bit more advanced, you have to eject and then you get a huge webpack config.
  • I tried it on a large code base, and it worked out-of-the-box!
  • Parcel looks like a decent alternative to Create React App.

We have all experienced the pain of getting started with React. You spend hours to configure webpack before you can start actual coding.
Continue reading “Create a React app with zero configuration using Parcel”

React v16.2.0: Improved Support for Fragments

React 16.2 is here:  - the biggest addition is support for

  • To make the authoring experience as convenient as possible, we’re adding syntactical support for fragments to JSX: – – In React, this desugars to a element, as in the example from the previous section.
  • Support for fragment syntax in JSX will vary depending on the tools you use to build your app.
  • Support for JSX fragments is available in Babel v7.0.0-beta.31 and above!
  • Upgrade to the latest TypeScript with the command: – – Flow support for JSX fragments is available starting in version 0.59!
  • A big thanks to everyone who filed issues, contributed to syntax discussions, reviewed pull requests, added support for JSX fragments in third party libraries, and more!

React 16.2 is now available! The biggest addition is improved support for returning multiple children from a component’s render method. We call this feature fragments:
Continue reading “React v16.2.0: Improved Support for Fragments”

Preact.js : Shopping Cart

@preactjs shopping cart with stock status. Link:  #preactjs #reactjs

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.


Continue reading “Preact.js : Shopping Cart”

Case study of SSR with React in a large e-commerce app – Jakob Lind

Case study of SSR with React in a large e-commerce app  #ReactJS

  • In this case study you will learn: – – In this case study, I present how we have implemented SSR (server side rendering) with React in an e-commerce application for one of Norway’s largest telco brands Telia.
  • What we have learned over the 3 years we have worked with the app is that keeping things simple helps a lot when implementing and maintaining an SSR solution.
  • The theory of SSR is pretty simple: you just render your React components on the backend and send the generated HTML to the client.
  • We create our Redux store with the initialState on the backend like this: – – The initialState variable is also sent to the frontend in a global variable so that the client side app gets the exact same state prefetched.
  • Here are some examples of variables that we guard against on server side: – – The process for knowing when to add the guard is something like: – – We are also careful to only use dependencies that work with SSR.

Setting up SSR (server side rendering) with React is painful. There is no good overview or starting point. Instead, you have to gather pieces of information from googling and do your best to puzzle them together.
Continue reading “Case study of SSR with React in a large e-commerce app – Jakob Lind”

Getting out of a .bind() – Frontend Weekly – Medium

Getting out of a .bind()  #babeljs #react #javascript #reactjs

  • bind()Thanks to class properties, never bind “this” to methods in class constructors again. 🎉The ShortInstead of this:class MyClass extends React.PureComponent { constructor() { this.myFunction = this.myFunction.bind(this); } myFunction() { const { myVar } = this.props; } … etc}With class properties enabled in Babel, bound class methods are simple:class MyClass extends React.PureComponent…
  • However, after clicking the “increment” button you’ll see the increment method throw an error:Cannot read property ‘state’ of undefinedWeird, why could ‘render’ access state but not ‘increment’?
  • React’s lifecycle methods are automatically bound to the current component instance, so render can access this.state.count.
  • The problem is any component method we create is not automatically bound.To fix the problem, we write this unintuitive line of code:constructor() { super(); this.state = { count: 0, } this.increment = Fields / Properties to the RescueClass Fields are a stage 3 proposal that you can use right now with…
  • With this proposal, these two class variables are declared in the context of the class instance, aka this.Thus, the this.state = {} inside of the constructor method is analogous to state = {} outside of the method.In the case of increment, we set an arrow function which inherits the lexical…

Everything renders correctly on load and render is referencing this.state.count as expected. However, after clicking the “increment” button you’ll see the increment method throw an error: React’s…
Continue reading “Getting out of a .bind() – Frontend Weekly – Medium”

I am Loving this Jelly Fish Splash React Animation see via @CodePen #ReactJs #React

  • You can apply CSS to your Pen from any stylesheet on the web.
  • Just put a URL to it here and we’ll apply it, in the order you have them, before the CSS in the Pen itself.
  • If the stylesheet you link to has the file extension of a preprocessor, we’ll attempt to process it before applying.
  • You can also link to another Pen here, and we’ll pull the CSS from that Pen and include it.
  • If it’s using a matching preprocessor, we’ll combine the code before preprocessing, so you can use the linked Pen as a true dependency.

Recreated https://dribbble.com/shots/2896850-Animated-DropSplash-Logo-Posibility with React and SVG…
Continue reading “I am Loving this Jelly Fish Splash React Animation see via @CodePen #ReactJs #React”