ASP.NET Core Basics: React with an API – Eric L. Anderson

#aspNETCore basics: build a #ReactJs app with an #API

  • This post is going to cover adding a React project to the existing using the React template that is now built into Visual Studio.
  • The goal for the React project in this initial post will be to connect to the contacts API and download a list of contacts and render that to the screen.
  • The following is the resulting React project in the context of the full solution.
  • Next, make sure and run npm install from a command prompt in the React project’s directory to ensure all the npm packages get restored.
  • Since this is my first time working with React I took the  FetchData.tsx file and copied the contents and used that as the starting point for my contact list.

In the past, I have done some exploration on Aurelia and Angular via the ASP.NET Core Basics series. This post is going to take a similar approach as I start doing some exploration with React. The code for the project will be in the same repo as the previous basics examples and will be utilizing the same API to pull data. The code before adding the React project can be found here.
Continue reading “ASP.NET Core Basics: React with an API – Eric L. Anderson”

react-native-tinder-navigator

Released! At  #reactnative #ios #androiddev

  • Each screen has its own representative icon that is shown on the application’s header – the icon of the screen shown in the viewport is always centered, and depending on which screen you’re in, the icons of the remaining screens are shown on the left/right edges of the header.
  • Clicking on any of the left/right icons will cause a screen transition, also allowing for the icons themselves to animate while the transition is in progress.
  • The library takes care of the screen and header transitions, and leaves it up to the user to define animations that occur on the icons during the transitions.
  • At the moment in which this was developed, react-navigation did not provide screen transitions from left to right, and the header transitions were difficult to customise.
  • We have thereafter integrated this project into others that are using react-navigation with excellen results, given that this navigator behaves as any other screen in the app.

A tinder style navigator that allows you to navigate between three adjacent screens with smooth header transitions.
Continue reading “react-native-tinder-navigator”

Using React’s Router in Single Page Web Apps (basics)

  • Using React’s Router in Single Page Web Apps (basics)Let’s face it.
  • Here’s an example:import { BrowserRouter as Router } from “react-router-dom”const App = () = { return ( Router …routes /Router )}The next thing we’ll need is the Route component (also from react-router-dom).
  • Example:import { BrowserRouter as Router, Route } from “react-router-dom”import { nav } from “/components/nav”import { homepage } from “/components/homepage”const App = () = { return ( Router Route path=”/” component={nav} Route path=”/home” component={homepage} /Router )}In this example, we will render the nav component on route “/” and we will match the homepage component on route “/home”.
  • Example:import { BrowserRouter as Router, Route } from “react-router-dom”import { welcome } from “/components/welcome”import { homepage } from “/components/homepage”const App = () = { return ( Router Route exact path=”/welcome/home” component={homepage} Route exact path=”/welcome” component={welcome} /Router )}The second option is to use another component from the library called Switch.
  • Example:import { BrowserRouter as Router, Route, Switch } from “react-router-dom”import { welcome } from “/components/welcome”import { homepage } from “/components/homepage”const App = () = { return ( Router Switch Route path=”/welcome/home” component={homepage} Route path=”/welcome” component={welcome} /Switch /Router )}Notice that even though the url path welcome/home should match both routes, we will only render the first matched route, thereby rendering the homepage component.

Building an SPA is super cool, and super exciting. Why is it so exciting? I guess it’s that intense feeling of accomplishment when you change the page without accessing a new web page. It gives us a…
Continue reading “Using React’s Router in Single Page Web Apps (basics)”

Why ReactJs? – (┛◉Д◉)┛彡┻━┻ – Medium

Why ReactJs?  #react #reactjs

  • Instead of writing an html line for news, messenger and marketplace you can see that they are basically the same, the only thing that changes is the icon and the information so we can make a component called nav that receives information and an icon.
  • Let code this component:First, we are going to make its container, with an JSON object with the information we want to be see.Now we are going to do the component:Using this practice, we are able to create a web app by just iterating a JSON object, that will pass the information to the containers.Another cool thing of react is its community.
  • There is a lot of components already made so you can just add them to your project as easily as adding a library to your normal html code.
  • Some github repositories that have a lot of components are:· lot of people have a problem with HTML being mixed with JS because they feel like breaking separation of concerns but in reality, it is more of a separation of technologies rather than concerns.
  • It helps your application to be more efficient because you don’t need to repeat code, there is an amazing community behind it, it has some really awesome modules that helps you to manage the unidirectional data flow, as well as managing which component must be render and if it is a component that is visible in all of the pages such as a menu to just render it once instead of every time you change of page.Tldr: react is awesome.

React is a new JavaScript library developed by Facebook released in 2013, but it wasn’t until 2017 that react was stable. React is like the best of both worlds, it has the functionality of JavaScript…
Continue reading “Why ReactJs? – (┛◉Д◉)┛彡┻━┻ – Medium”

Intro to React – Christopher Hague – Medium

Intro to React  #learning #react #javascript #programming #learningtocode #reactjs

  • Here is another representation of how we can conceptualize our component hierarchy:- Application – Search Bar – Product Table – Category – ProductThe Trickle Down EffectHow does our application use each of the components to interact with one another?
  • In the same way that functions rely on arguments to operate on and manipulate data, components rely on props that are given as a they being declared.Using the example from above, it becomes easier to conceptualize how the Product and Category components are rendering the appropriate information onto the screen.
  • When the Product Table component is declared within the Application component, the Application will pass down this information related to all of the products to the Product Table as props.
  • As such, the Search Bar component will inherit a set of functions that define how the products in the API will be filtered based on the user input.The Category and Product components will then rely on the props passed down from Product Table to render the list of items, using the Search Bar component to filter the products based on the search terms and render only those products to the screen.
  • Conversely, if the search bar is empty then each product in the collection will be rendered.Divide and ConquerNow that we have some idea of how we want each of our components to function, let’s sketch each of them out below to get some idea of how the code for the app might look:class Category extends React.Component { // renders categories}class Product extends React.Component { // renders products}class ProductTable extends React.Component { // declares a Category and Product component, passing props to each of them Category category={product.category} key={product.category} / Product product={product} key={product.name} / // renders Category, Product}class SearchBar extends React.Component { // renders SearchBar // filters based on search terms}class Application extends React.Component { // renders SearchBar and ProductTable components, passing props to each of them SearchBar / ProductTable products={this.props.products} /}Now that we have all of our components defined, rendering the application to the screen becomes as simple as using the ReactDOM.render function and passing the Application component to it.ReactDOM.render( Application products={PRODUCTS} /,

React is a declarative, component-based JavaScript library used for building user interfaces. It was created by Facebook employee Jordan Walke and was first deployed on Facebook and Instagram in 2011…
Continue reading “Intro to React – Christopher Hague – Medium”

[React Native 016.3] Using GraphCool with React Native

Using @graphcool with @reactnative -  #reactNative #programming

  • The second screen is a screen to create a post, by passing the image URL and the post description.
  • The rest of the ListPage component is just a list showing each Post and its image.
  • Let’s use this mutation and create a new Post:

    Once we run this mutation, we can refresh our app and see this new Post we have created in our app.

  • On the inline code, we will put our code, it does a POST request to our slack, and we will pass the post description and image url.
  • Let’s save, that, open our slack and create a new Post in our App.

A serverless solution for GraphQL that works great with React Native
Continue reading “[React Native 016.3] Using GraphCool with React Native”

react + d3 = vx – vx code – Medium

react + d3 = vx - A new data visualization library for #reactjs by @hshoff

  • You just need to use d3 and magic dances across your screen.Of course, the last time you made a chart with d3 was 3 or was it 4 years ago?
  • “I wish there was something more like d3 I could use,” you say.Enter vxreact + d3 = vxMixing two ways to update the DOM is never a good time.
  • Me too.So I set out making a library of low-level components that could be used to build up reusable charts or those one-off requests or that special idea you had for a visualization that you’ve never seen done before.About vxGoal The goal is to create a library of components you can use to make both your own reusable chart library or your slick custom one-off chart.
  • If you’re creating your own awesome chart library on top of vx, it’s easy to create a component api that hides d3 entirely.
  • The vx collection of components lets you easily build your own reusable visualization charts or library without having to learn d3.

You’ve fallen in love with React. You’ve built a redux app. You’ve dabbled with GraphQL. You’ve started following along with Relay Modern and Apollo Client. But your next project is a dashboard that…
Continue reading “react + d3 = vx – vx code – Medium”