Things to like in @stenciljs: – Compiles to #WebComponents – #TypeScript by default – JSX familiar to #Reactjs devs

  • The extension is required since Stencil components are built using JSX and TypeScript.
  • Here is an example of what a Stencil component looks like:

    Once compiled, this component can be used in HTML just like any other tag.

  • This decorator provides metadata about our component to the Stencil compiler.
  • This decorator tells the compiler that the property is public to the component, and the user should be setting it.
  • If a user of our component were to change the element’s property, our component would fire it’s function again, updating the displayed content.

Stencil components are created by adding a new file with a .tsx extension, such as my-first-component.tsx, and placing them in the src/components directory.
The .tsx extension is required since Stencil components are built using JSX and TypeScript.
Continue reading “Things to like in @stenciljs:
– Compiles to #WebComponents
– #TypeScript by default
– JSX familiar to #Reactjs devs”

A stronger (typed) React Apollo – Apollo GraphQL

A stronger (typed) React Apollo:  #ReactJS #GraphQL

  • Helping developers understand what they can use in their React components was our first priority when we set up flow types for Apollo.Let’s take for example a simple React component wrapped with the graphql HOC from React Apollo.
  • This component will display a hero from Star Wars and their friends with data returned from a GraphQL endpoint:The above code pulls some data from a GraphQL API using a query and includes lifecycle information, such as loading and error information.
  • We tell Flow what the shape of the result will look like from the server when the graphql enhancer wraps a component.
  • If you already are a user of Flow and have your data typed already, with a couple of imports and a single type addition, you can type any component that is wrapped with graphql!Currently Flow does not support the ES7 decorator syntax so you won’t be able to get all of the benefits of stronger type support if you are using decorators.
  • Let’s make a change to our initial component that converts it to use a prop called episode:We can define the props that our exported component will need (InputProps) and attach them to our enhancer using the second type generic of OperationComponent.

Static typing can be low-hanging fruit to improve your app. As data flows throughout the application, it is easy to forget its shape, and even for what it’s used. Although you could have unit tests…
Continue reading “A stronger (typed) React Apollo – Apollo GraphQL”

Using JSX with Vue.js – Anthony Gore – Medium

Using JSX with Vue.js  #webdevelopment #javascript #react #vuejs #vue #reactjs

  • Using JSX with Vue.jsLove it or hate it, JSX is a popular extension to JavaScript that allows XML tokens in your scripts.If you want to create templates in your script files and you find Vue’s render() function to be difficult to work with, JSX may be just what you need.To demonstrate, here’s a render function without JSX:And with JSX:If nothing else, it’s much easier to read!Of course, JSX cannot be interpreted by the browser.
  • More on this later.Note: this article was originally posted here on the Vue.js Developers blog on 2017/02/27Why use JSX with Vue?There are many ways to specify a template in Vue:Using an HTML fileUsing a template property in your instance/component constructorUsing template tags in single file componentsUsing a render function.If you go with option 4, you have to create your nodes in a very unfamiliar way i.e. using the createElement JavaScript syntax.JSX allows you use a render function and still have the look and feel of HTML.
  • When you click the span it will trigger an alert.Firstly, let’s use Vue in the normal way with separate JS and HTML files:Incorporating a render functionThe following code does exactly the same thing as the above code, the only difference is that rather than using a template we will use a render function to create our template:Incorporating JSXThe render function is a little hard to read, right?
  • And that’s just for one span, imagine using it for a more complex component!Let’s use JSX now:(index.html same as above)Transpiling JSXJSX is just for development and will be transpiled away long before runtime.
  • Simply add it to your Webpack config:Now, when you do a webpack build, your JSX will be transpiled into standard JS.Get the latest Vue.js articles, tutorials and cool projects in your inbox with the Vue.js Developers Newsletter

If you want to create templates in your script files and you find Vue’s render() function to be difficult to work with, JSX may be just what you need. Of course, JSX cannot be interpreted by the…
Continue reading “Using JSX with Vue.js – Anthony Gore – Medium”

All the Arrows point to REACT.js – Brad Hankee – Medium

All the Arrows point to REACT.js  #react #es6 #javascript #reactjs

  • After three tutorials and falling down a number of rabbit holes my brain feels numb by dinner and feels strangely ready to get back at it while the morning coffee is brewing the next day.Not only is React great but I feel like I am simultaneously becoming more proficient at HTML, CSS and JavaScript.
  • It is also solving many puzzles for me like some ES6 syntax I have been sighing at for the past few weeks not knowing what is was.Ok, to explain the idea behind the picture I think I now understand, and maybe even like, arrow functions.
  • The arrow function doesn’t just make for more concise and cleaner code but it actually has a major impact on React with the ‘this’ word.When using ‘this’ in a function it takes on that function’s scope.
  • The great thing about making that same function with the arrow syntax is now that same ‘this’ will now use the scope outside of that function.
  • The reason why I focused so much on React this week is because it’s both enjoyable and easy to see what’s going on.

This week has been great! Eating steak, buying a 28″ monitor, grass seed is actually growing and 40 hours of learning React.js. After three tutorials and falling down a number of rabbit holes my…
Continue reading “All the Arrows point to REACT.js – Brad Hankee – Medium”

intro-to-react/README.md at master · ericvicenti/intro-to-react · GitHub

  • We can modify our component to display the data being passed in:

    Near the top of the file, lets add some different places that we might want to display weather for:

    Now, upgrade the App’s render function to iterate over each place, and render a tag for it.

  • We want our app to be able to switch between places, so we can use state to keep that data in our App component.
  • Let’s use the and in our App component:

    At this point, your file should look like this.

  • Let’s install it, alongside which provides the React components for it:

    In the top of the app file, import the css from the bootstrap module:

    Next, import the components we want to use from .

  • Now, replace the App component’s render function to use the bootstrap components:

    Now our app is starting to look more polished, but it would be nice to have a custom theme.

intro-to-react – A Hands-On Walkthrough of your first React Web App
Continue reading “intro-to-react/README.md at master · ericvicenti/intro-to-react · GitHub”

height_change:ne->update_projection

  • I started to look into this problem and realized that a solution to this is to maintain only the visible portion of an infinite list in the DOM tree and render/remove invisible parts as the user scrolls.
  • Using the in-place measurement also allow us to accommodate cases where the item height is changed after rendering, such as when loaded images change the overall height of a tweet.
  • Think of the case where a user has scrolled down 5 pages: if they choose to resize the window, we will want the app to adapt to it gradually instead of waiting for to remeasure all items; fortunately the in-place measurement technique works with this scenario.
  • We update new item heights into cache and allow the system to correct itself as the user scrolls.
  • Whenever there is a difference in expected item heights and the actual item heights, the scroll position will be affected.

I have worked on Twitter’s new mobile website for the past year. We rebuilt the
website using the latest web technologies: React, Redux, Node.js/ …
Continue reading “height_change:ne->update_projection”

HashBang Weekly

  • Meteor gives you a fantastic and solid base for building modern apps.
  • If you have been considering moving away from Meteor, some helpful tips from the team who built one of the first production at-scale meteor apps.
  • A neat tutorial using React and Meteor with Tokbox to build a simple video chat app.
  • Dean reiterates why Meteor is not going away any time soon.
  • ‘s your weekly dose of Meteor/GraphQL/React news.

A curated newsletter for all things Meteor, React, & GraphQL

Stay updated without spending hours looking for what is relevant

News & Updates – Events – Breaking Changes

Written & curated by Karl Danninger with help from the rest of the team at OK GROW!.

Continue reading “HashBang Weekly”

Playing with D3 Version 4, React, React-Motion – Chris Roth – Medium

Playing with D3 Version 4, #reactjs, React-Motion – Medium

  • We just set up a component with an svg container.
  • Live Example (sorry, direct links to the examples are currently broken)
  • Example 3: An animated path using react-motion
  • All three examples provide different findings, see summary at the bottom.
  • The example provides a way to animate the graphs in React.

Here we present 3 examples, combining the power of the new d3 Version 4 modules and React (and React-Motion, and Redux). Based on the new d3 modules by Mike Bostock, we wanted to find out a bit about…
Continue reading “Playing with D3 Version 4, React, React-Motion – Chris Roth – Medium”

Top 6 Reasons Why We Love React – Syncano – Medium

  • The approach gives you enormous flexibility and amazing gains in performance because React calculates what changes need to be made in the DOM beforehand and updates the DOM tree .
  • Bonus: Mobile Apps using React Native
  • Once you get comfortable with building web application with React, you can easily switch to building mobile application using React Native .
  • When you start your adventure with React, don’t forget to install the official React Chrome extension .
  • Tutorials: Go build awesome stuff with React!

Our front-end team at Syncano loves trying new things. New frameworks, new build tools… anything that makes our work more efficient…
Continue reading “Top 6 Reasons Why We Love React – Syncano – Medium”