Git Product home page Git Product logo

natwest-frontend-code-test's Introduction

Natwest-Frontend-Code-Test

React application to fetch and display stub payments data.

Available Scripts

In the project directory, you can run:

npm install

Installs the projects' dependencies.

npm start

Additional Comments

Best Practices Implemented

(Some of these are somewhat undermined by the scale of the app).

  • Component-centric file structure. Files related to a specific component should be kept under a single folder.
  • Decomposition of large components into small components (PaymentsTable.jsx). Ensures that components perform a singular function - its generally easier to manage, test, reuse and create a new small components.
  • Appropriate, concise & descriptive naming and caps-casing of components, variables, app-level constants, props and state.
  • React functional components.
  • Destructuring props.
  • Dynamic rendering with the && operator.
  • Wrapping the rendered output in a fragment, rather than div tags - satisfies React and avoids adding an additional node onto the DOM.
  • try-catch blocks.
  • ES6 features (let/const, arrow functions, Async Await etc).

Scope for further work

  • Props validation and default props with .propTypes & .defaultProps.
  • Unit and component testing with Jest & RTL.
  • Review whether I've been too defensive with nullsafe accessors - some may be redundant/duplicated.
  • Ensure to always use unique keys across the app. Not every array item in the app has a unique id, so I could've (and should've) used an external library like uuidv4 for generating unique ids (see [array].map functions in PaymentsTable.jsx).
  • In app.jsx, the isLoading & isInitialLoad state values are so closely tied that they could likely be combined/consolidated into one value.
  • Split the PaymentTable into 3 seperate components for testability - PaymentsTable, PaymentsTableHeader & PaymentsTableBody.

Other considerations/nice-to-haves

  • Dockerising the application.
  • Implementing a build & test pipeline into the PR process.
  • Environment variables for handling multiple possible API hostnames/endpoints.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.