Skip to content

Latest commit

 

History

History
67 lines (50 loc) · 2.48 KB

README.md

File metadata and controls

67 lines (50 loc) · 2.48 KB

Cadasta React-Esri Client

Edit esri-react

Example app to explore how stuff works.

TODO


Development

This project was bootstrapped with Create React App using the TypeScript React Starter. More documentation can be found in either of those repositories' READMEs.

The codebase follows the conventions of Containers vs Components. It is strongly recommended that you familiarize yourself with those concepts.

Installation

yarn global add create-react-app # Install create-react-app
yarn # Install package dependencies

Running Server

yarn start

Running Tests

yarn test

React Fundamentals

When Rendering

  • No for loops, use .map:
    {
        // Remember that repeated elements must have a unique 'key' attribute
        ['apple', 'pear', 'orange'].map((fruit: string, index) => <h2 key={index}>{fruit}</h2>)
    }
  • No if statement, use &&:
    // this will only render the 'Yes' element if `isLoaded == true`
    { isLoaded && <h2>Yes!</h2>}
  • No if/else statements, use a conditional (ternary) operator:
    // this will only render the 'Yes' element if `isLoaded == true`, otherwised rendering the 'Nope' element
    { isLoaded ? <h2>Yes!</h2> : <h2>Nope!</h2> }

if and if/else statements are actually valid within React, however this codebase has an established pattern of using the above instead.