react - newgeekorder/TechWiki GitHub Wiki

React and Gradle

Using the node plugin we can execute node command to develop, test and deploy

    id "com.github.node-gradle.node" version "3.2.1"

so for react dev start we can

task start(type: NpmTask, dependsOn: npmInstall) {
    args = ['run', 'start']
}

bundle for production build

task bundle(type: NpmTask, dependsOn: npmInstall) {
    args = ['run', 'build']
}



# Header Elements 
* react helmet plugin

# React Sass
1)First install sass dependency using npm:

npm install sass

2)Import your sass file to your componentName.js file

import '../scss/FileName.scss';

## Error Boundary 
Catch errors and prevent them from bubbling up  - create an ErrorBoundary.tsx

```javascript 
/**
 * Error Boundary
 *
 * - used by top level App
 * - catch JS errors and display
 */

import React, { Component } from "react";

interface PropsInterface {}

interface StateInterface {
  hasError: Boolean;
  error?: Error | null;
  info?: object;
}

class ErrorBoundary extends Component<PropsInterface, StateInterface> {
  state = { hasError: false };

  componentDidCatch(error: Error | null, info: object) {
    this.setState({ hasError: true, error, info });
  }

  render() {
    if (this.state.hasError) {
      return <h1>Something went wrong.</h1>;
    }
    return this.props.children;
  }
}

export default ErrorBoundary;

Static Site

https://yasoob.me/posts/how-to-prerender-react-apps-using-prerender-io-seo/

assemble.dependsOn(bundle)



## Data Tables 

* https://react.rocks/tag/DataTable
⚠️ **GitHub.com Fallback** ⚠️