precept/examples/fullstack at master · CoNarrative/precept · GitHub

  • The client uses reagent for the view, cljs-http for making REST calls, and sente for the socket connection.
  • Any result obtained or process described is simply the application of rules to facts unless otherwise stated.
  • We have written a rule rule matches on it and makes REST calls to fetch the cart and a list of products from the server.
  • Because its eid is , there is some magic here, as Precept auto-retracts any fact with the eid of at the end of every session, ensuring such facts survive one rule firing only.
  • When a response from the server is received, facts are inserted into the session, rules fire, state advances, and views update.

precept – A declarative programming framework
Continue reading “precept/examples/fullstack at master · CoNarrative/precept · GitHub”

#React Tutorials – Day 2 – Environment Setup by @pankajmalhan30 cc @CsharpCorner #ReactJS

#React Tutorials - Day 2 - Environment Setup by @pankajmalhan30 cc @CsharpCorner  #ReactJS

  • Create React App

    After installing the React global packages now run “create-react-app reactapp” command, this command will create a React project and name this project as “reactapp”.

  • Now you are in root directory of the project again run the “npm start” command this command run the React project on “3000” port.
  • Now, run the command “dotnet new React“

    This command creates a template project for React Application.

  • Using Webpack and Babel

    So far we set up the React Environment set up using the npm and Visual Studio 2017 SPA templates.

  • Now we will focus on the Webpack and babel to setup the React project.

In this article you will learn about Environment Setup in React.
Continue reading “#React Tutorials – Day 2 – Environment Setup by @pankajmalhan30 cc @CsharpCorner #ReactJS”

⚛ React.js & React Native Berlin Meetup at NewStore

⚛ React.js & #reactnative Berlin Meetup at NewStore

  • Thanks to the great speakers, companies and community within less than 6 month the React Native Berlin Meetup became the

    .

  • With React Native you can build fast Native iOS, Android and Windows Mobile Apps.
  • We are happy to see you at our next React Native Berlin meetup.
  • Topics all about React Native: Building native iOS, Windows & Android Apps, using GraphQL, live-coding, out-of-the-box and custom animations, building react native apps interactively (Language agnostic: ReactJS, AngularJS, PhP, Ruby, Python, HTML, CSS), push notification with Swift-Javascript, Redux, Meteor, Games, ClojureScript, TypScript, ES6, ES7, integration of APIs (Facebook, Twitter, Instagram, Pinterest, Snapchat, eBay, WordPress, Drupal, Joomla, Paypal, Stripe third party websites), web, hybrid apps and ionic, mobile marketing, sales and analytics, big data, databases, fintech, ecommerce, fashiontech, listing, search engine, apple and google store optimisation, fast test minimum viable product (idea to MVP, Lean startup) for startups, develop innovative technology, Navigator, NavigationExperimental, ExNavigation, React Native Router, and React Native Navigation, drawing charts in react native, testing, prototyping in react native + recommend a further topics you are interested in.
  • • Is your company interested in sponsoring React Native Berlin?

React Native Berlin Meetup at NewStore

19.00 – 19.30: Arrivals
19.30 – 19:35: Introduction by NewStore & Markus Lühmann, Founder & CEO of Galaxonic
19.35
Continue reading “⚛ React.js & React Native Berlin Meetup at NewStore”

Recreating the Chrome Console in React – LogRocket

  • Since a session could potentially have thousands of logs, we knew that we’d need to build a virtual list where DOM nodes are unmounted when they leave the viewport.User-interactive JSON treeExpanding objects in the Chrome ConsoleLike the Chrome javascript console, users should be able to expand objects that were logged.
  • Simply knowing the length of the list and having a rowRenderer function that can render a given row is all it needs!Our ImplementationI’m not going to describe every detail of our console implementation since much of it is a standard application of react-virtualized, but there are a few bits where we diverged that are interesting.Row HeightsAs I described earlier, react-virtualized takes a prop rowHeight which is a function that returns the height of a row at a given index.In this screenshot of the LogRocket log viewer, notice that there are 2 states for each row: default, and expanded.
  • However, when a row is expanded, its height varies as the user expands different subtrees of the object.We needed a way to write a rowHeight function that handles dynamic height rows- something like this:In order to implement getExpandedRowHeight in the above psuedo-code, there were two potential options.Guarantee deterministic height of an expanded objectTo achieve this, we would have needed to design the object tree view component from the ground up to make its height a pure function of the subtrees that are expanded.
  • Also, making this guarantee would make it difficult to iterate on the look and feel of the log viewer since changes to things like margins and padding would need to be adjusted for.Use react-measureInstead, we opted to use a library called react-measure which provides a helpful abstraction for writing components that are aware of their own height.react-measure wraps a given component and takes a prop, onResize which is a function that is called whenever the component’s size changes.In our case, whenever the size of a given row changes, we dispatch a Redux action which stores the height of that row in Redux.
  • Then in our rowHeight function, we simply get the height of the row from Redux, and react-virtualized can render it properly.There is a small performance penalty to this approach, since react-measure uses the DOM resize-observer API which isn’t implemented natively in all browsers, but in practice this is fairly minimal.Apollo ClientTo handle data fetching, we use apollo-client which is a GraphQL client that works nicely in React apps.

One of the core features of LogRocket is the replay of console and Redux logs in production web apps. To do this, you add the LogRocket SDK to your app which sends logs to LogRocket. Then, when…
Continue reading “Recreating the Chrome Console in React – LogRocket”

JSK Weekly is out. Come and see the best stories of the past week #javascript #reactjs

JSK Weekly is out. Come and see the best stories of the past week  #javascript #reactjs

  • JavaScript modules are with us.
  • Browsers implement them natively, and now Node.js decided to introduce them using *.
  • Johannes Ewald writes about the current state of JavaScript modules, including browser implementations, Webpack, Node.js changes, what does it means for library creators, users, etc.
  • If you are still struggling with parallelism and concurrency, take a look at Jonathan Martin’s article on elegant concurrency patterns in JavaScript.
  • Also big news last week was the release of Node.js 8 which includes npm version 5, a new version of V8 engine with significant performance optimizations, native add-ons support, buffer changes, and much more.

JavaScript modules are with us. Browsers implement them natively, and now Node.js decided to introduce them using *.mjs extension which caused quite a stir in the community. Johannes Ewald writes about the current state of JavaScript modules, including browser implementations, Webpack, Node.js changes, what does it means for library creators, users, etc.

Jake Archibald has a great article on HTTP/2 push specification where he takes a deeper look into it and the problems with the various browser implementations.

If you are still struggling with parallelism and concurrency, take a look at Jonathan Martin’s article on elegant concurrency patterns in JavaScript. He covers event loop, promise chaining, async functions, parallel execution and other topics.

Also big news last week was the release of Node.js 8 which includes npm version 5, a new version of V8 engine with significant performance optimizations, native add-ons support, buffer changes, and much more. We have several articles covering the new features.

Continue reading “JSK Weekly is out. Come and see the best stories of the past week #javascript #reactjs”

How to deploy a live ReactJS/Redux website in under 10 minutes

How to Deploy A Live ReactJS/Redux Website in Under 10 Minutes:

  • Set up AWS S3 bucket (time: ~5 minutes)a) Log into AWS console and click on S3b) Click create bucket and enter a Bucket name(example: onederful-quickstart).
  • Click Next through all the remaining steps and create the bucket.In Bucket name, use a unique name for your appc) On the list view, click on the newly created bucketYour newly created bucket should be in the list viewd) A popup will show up, click on propertiesClicking on the properties panel will redirect you to the properties tab for the buckete) Click on Static website hosting and enter in index.html for both fields Index document and Error documentThe endpoint is the public URL you can share with anyone.
  • The error document being set to index.html enables the React app to define and handle all the routing rather than S3f) Click on permissions tab and copy and paste the policy (replacing [YOUR BUCKET NAME] with your bucket name){ “Version”: “2012-10-17”, “Statement”: [ { “Sid”: “AllowPublicRead”, “Effect”: “Allow”, “Principal”: “*”, “Action”: “s3:GetObject”, “Resource”: “arn:aws:s3:::[YOUR BUCKET NAME]/*” } ]}This policy allows everyone (principal: “*”) to see the objects (your website) in your bucket.
  • If you don’t include this, the endpoint in step e) will return a 403 unauthorized error as it defaults the bucket to private.

Ever had an webapp idea that you wanted to quickly prototype and send to people? After going to 8+ hackathons and winning over $105,000 in prize money, I’ve found a pretty good way to get a fully…
Continue reading “How to deploy a live ReactJS/Redux website in under 10 minutes”

Using React-Native just for UI development in Android App

Building an Android app using React-Native  #android #reactnative #reactjs #reactjs

  • It can be used, for example, to sync fresh data, handle push notifications, or play music.Its similar to creating an android service in java, just using it you can create service in javascript as well.Register the js service using the below codeimport {task} from () = task);Then, in SomeTaskName.js:export async function task(taskData) { console.log(‘BACKGROUND AUDIO’)}Create a service in your base packagepublic class MyTaskService extends HeadlessJsTaskService getTaskConfig(Intent intent) { Log.d(“MyTaskService”, “task invoked in java”); Bundle extras = intent.getExtras(); return new HeadlessJsTaskConfig( “SomeTaskName”, null, 5000); }}// Register this service in AndroidManifest.xml // service if you start this service like any other service it will invoke the corresponding the javascript code.
  • Here is the example for running inside the broadcast receiver.public class MyReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { Toast.makeText(context, “Intent Detected.”
  • Here are the steps on how you can do that.Create your CustomModule containing your methodpublic class ToastModule extends ReactContextBaseJavaModule { private static final String DURATION_SHORT_KEY = “SHORT”; private static final String DURATION_LONG_KEY = “LONG”; public reactContext) { super(reactContext); } @Override public String getName() { return “CustomToastAndroid”; } @Override public MapString, Object getConstants() { final MapString, Object constants = new HashMap(); Toast.LENGTH_SHORT); Toast.LENGTH_LONG); return constants; }//this @ReactMethod will be available in javascript environment @ReactMethod public void show(String message, int duration) { Log.d(getName(),”toast called with “+message); MyTaskService.class)); message, duration).
  • show(); }}Create a CustomReactPackage.java to register your modulepublic class CustomReactPackage implements ReactPackage { @Override public ListClass?
  • extends JavaScriptModule createJSModules() { return Collections.emptyList(); } @Override public ListViewManager reactContext) { return Collections.emptyList(); } @Override public ListNativeModule createNativeModules( ReactApplicationContext reactContext) { ListNativeModule modules = new ArrayList(); modules.add(new ToastModule(reactContext)); return modules; }}Update your MainApplication file to include your CustomReactPackageprivate final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { @Override public boolean getUseDeveloperSupport() { return BuildConfig.DEBUG; } @Override protected ListReactPackage getPackages() { return Arrays.ReactPackageasList( new MainReactPackage(), new CustomReactPackage() //custom package is added here ); }};Here are the steps to use your custom module in ReactJSimport { NativeModules } from ‘react-native’;ToastAndroid =

Its similar to creating an android service in java, just using it you can create service in javascript as well. Now suppose you want to invoke a service or method defined in native code, in that case…
Continue reading “Using React-Native just for UI development in Android App”