Cosmic JS Blog Stay tuned for feature roll-outs, news and updates as we continue to help you manage content for your websites and applications faster and easier.

How to Build a Cross-Platform Blog Using #ReactNative, #NodeJS and #CosmicJS 🚀

  • Cosmic JS is an API-first cloud-based content platform that makes it not only easy to add dynamic content to any existing or new website, but makes it possible to seamlessly deliver content across devices and platforms.
  • This comes with everything you need to get started with a basic website as well as the codebase for the native applications running React Native for iOS and Android.
  • React Native is a very powerful way to build applications for both iOS and Android.
  • To install and run the iOS React Native application run the following commands: – – Run the following commands to run the Android application (make sure you have your Android device emulator open): – – – – Looking at index.ios.js and index.android.js you will notice that the root of our…
  • Now when you edit content in your Cosmic JS bucket, you will see that the content automatically updates across Web, iOS and Android applications.

Cosmic JS is a cloud-hosted content platform that offers a flexible and intuitive CMS API. Build websites and applications with more freedom and manage content easier. Get started for Free.
Continue reading “Cosmic JS Blog Stay tuned for feature roll-outs, news and updates as we continue to help you manage content for your websites and applications faster and easier.”

Mapbox GL JS + React – Points of interest

Mapbox GL JS + React  #react #product #frontenddevelopment #redux #javascript #reactjs

  • What’s shown to the user when a component calls render() is conveniently managed internally allowing an implementor to work on higher level tasks like how an interface behaves.What can be confusing is connecting React with other libraries that manipulate the DOM and manage state (like Mapbox GL JS).
  • The wrapper permits customization like size or title, and the technical details that should always be the same (event handling of key bindings or accessibility) is tucked away in the lower level modal component.So it’s natural to look for a Mapbox / component within the React ecosystem (see react-map-gl or react-mapbox-gl as example).
  • The map is initialized within componentDidMount and its container value is set as the assignment of this.mapContainer which is React’s way of providing direct access to the DOM node.Let’s explore some more in-depth examples:Basic exampleSee full example on GitHubIn this example, React passes position data as state to the map.
  • This could also be prop data passed from a higher level component but in the interest of containing the entire app as one component I’ve used state.Reactive tooltip exampleSee full example on GitHubThe details to note are:Data found in vector tiles is collected under the mouse cursor using queryRenderedFeaturesA mapboxgl.Marker instance is used to display the collected data on the map (Mapbox GL JS controls its position on the map) but the contents of the marker is React powered using ReactDOM.render.Fetching map data like this isn’t exclusive to tiles directly from Mapbox.
  • To learn more how we use Redux in Mapbox Studio, check out, Redux for state management in large web apps by David Clark.I hope this helps as a primer on using Mapbox GL JS alongside React and provides some context for how we achieve a few different concepts here at Mapbox.

When we build web applications at Mapbox we often turn to React and Mapbox GL JS. The goals of each library work powerfully in combination and I’d like to share some techniques into how we approach…
Continue reading “Mapbox GL JS + React – Points of interest”

5 simple steps to quickly start a new VR project – Hacker Noon

  • This will tell git to ignore the node_modules folder and the final bundled javascript file.Step 2: Create a file structureIn project, there will be two main components, a client and a server.
  • Since this project will use webpack to bundle the react code, add another two folders into the client folder, and name them ‘src’ and ‘dist’Step 3: Creating the ServerThis will create a Node/Express server that will serve the client whenever the url is called.Create a file inside the server folder and name it index.js.Inside terminal, type yarn install and press enter.
  • Inside the terminal type: touch webpack.config.js, then add this into the file:var path = require(‘path’);var SRC_DIR = path.join(__dirname, ‘/client/src’);var DIST_DIR = path.join(__dirname, ‘/client/dist’);module.exports = { entry: `${SRC_DIR}/index.jsx`, output: { filename: ‘bundle.js’, path: DIST_DIR }, module : { loaders : [ { test : /\.
  • Go to the terminal and type yarn build and after it’s done, type yarn start .
  • In the terminal, type:yarn add aframe aframe-react add this into index.jsx (this code is copied directly from aframe-react official repo):import React from ‘react’;import ReactDOM from ‘react-dom’;import ‘aframe’;import {Entity, Scene} from ‘aframe-react’;import ‘babel-polyfill’;import App extends React.Component { render () { return ( Scene Entity geometry={{primitive: ‘box’}} material={{color: ‘red’}} position={{x: 0, y: 0, z: -5}}/ Entity particle-system={{preset: ‘snow’}}/ Entity light={{type: ‘point’}}/ Entity gltf-model={{src: ‘virtualcity.gltf’}}/ Entity text={{value: ‘Hello, WebVR!’}}

A-Frame is a great way to get into developing VR, especially for those who come from a Javascript background. For those who dont know what A-Frame is, here is the official description taken directly…
Continue reading “5 simple steps to quickly start a new VR project – Hacker Noon”

i18n with CSS – Coding Outside the Box – Medium

i18n with CSS  #html5 #javascript #react #webdevelopment #css #reactjs

  • JavaScript on the other hand always felt to me like an awkward fit for this task.Internationalization by means of cascading stylesheetsI thought about how to do this with CSS instead and it occurred to me that I could also leverage HTML 5’s lang global attribute.
  • And the :lang() selector provides a powerful way to translate all or part of a site into multiple { content: ‘ÂĄHola Mundo!’ }
  • While unconventional this approach has some advantages like being able to instantly switch the language of a page in its current state — simply by setting the lang attribute of the corresponding DOM element:document.body.lang = ‘es’The main disadvantage is that this method is quite verbose on the stylesheet side.
  • The markup though ends up looking pretty clean:h1 class=”msg-title”/h1h2 class=”msg-subtitle”/h2p class=”msg-description”/pAnd if we happen to make use of LESS, SASS or any other preprocessor we can reduce the CSS verbosity to a minimum.
  • And the best part is that this technique plays nicely with any javascript famework such as React since it operates only on the rendered markup and stylesheet layers.

Externalizing and internationalizing messages in a web application is the kind of problem that used to be easy to solve with server-side scripting tecnologies. JavaScript is a different story
Continue reading “i18n with CSS – Coding Outside the Box – Medium”

How to Build a Cross-Platform Blog Using React Native and Node.js

How to Build a Cross-Platform Blog Using React Native and Node.js

  • You need to download Android Studio and make sure you have the correct version of the Java SDK installed and make sure you have all of the developer tools installed.
  • Looking at index.ios.js and index.android.js you will notice that the root of our application for both iOS and Android runs at App.js.
  • Now when you edit content in your Cosmic JS bucket, you will see that the content automatically updates across Web, iOS and Android applications.
  • React Native is a very powerful way to build applications for both iOS and Android.
  • Cosmic JS is an API-first cloud-based content management platform that makes it easy to manage applications and content.

Originally written by Tony Spiro for CosmicJS.com. Tony Spiro is the Co-Founder & CEO of Cosmic JS, an API-first Cloud-based Content Management Platform that decouples content from code, allowing…
Continue reading “How to Build a Cross-Platform Blog Using React Native and Node.js”

How to Build a Cross-Platform Blog Using React Native and Node.js — Medium — Medium – Medium

##ReactJS and React Native Stories for JavaScript Web Architects, Builders, Ninjas and...

  • Never miss a story from ReactJS News , when you sign up for Medium.
  • #ReactJS and React Native Stories for JavaScript Web Architects, Builders, Ninjas and the like.
  • Now when you edit content in your Cosmic JS bucket, you will see that the content automatically updates across Web, iOS and Android applications.
  • Cosmic JS is an API-first cloud-based content management platform that makes it easy to manage applications and content.
  • React Native is a very powerful way to build applications for both iOS and Android.

“How to Build a Cross-Platform Blog Using React Native and Node.js — Medium — Medium” is published by ReactJS News
Continue reading “How to Build a Cross-Platform Blog Using React Native and Node.js — Medium — Medium – Medium”

How to Build a Cross-Platform Blog Using React Native and Node.js — Medium – Medium

You need to download Android Studio and make sure you have the correct version ...  #react

  • #ReactJS and React Native Stories for JavaScript Web Architects, Builders, Ninjas and the like.
  • Never miss a story from ReactJS News , when you sign up for Medium.
  • Now when you edit content in your Cosmic JS bucket, you will see that the content automatically updates across Web, iOS and Android applications.
  • React Native is a very powerful way to build applications for both iOS and Android.
  • Cosmic JS is an API-first cloud-based content management platform that makes it easy to manage applications and content.

“How to Build a Cross-Platform Blog Using React Native and Node.js — Medium” is published by ReactJS News
Continue reading “How to Build a Cross-Platform Blog Using React Native and Node.js — Medium – Medium”