Giter Club home page Giter Club logo

jumbo-marvel's Introduction

Example

Spec

Acceptance Criteria

  1. Must use the marvel API (https://developer.marvel.com/)
  2. Primary language used must be JS
  3. It must display a list of characters
  4. Each character must link to their own details page
  5. The layout must be responsive for desktop and mobile clients
  6. Browser history must be maintained when navigating between views

Considerations

When creating the app consider the following areas :

  • Modern development practices
  • Performance
  • Scalability
  • Testability

Setup

This has been tested with:

Setup steps:

In your terminal...

  • Run git clone https://github.com/patrickgordon/jumbo-marvel.git patrickgordon-jumbo-marvel
  • Run cd patrickgordon-jumbo-marvel
  • Run yarn install
  • Run yarn start

Implementation comments

  • I used create-react-app to get the ball rolling.
  • Decided to roll my own CSS to keep things lightweight
  • Redux added to ensure that the route structure can be upheld and when opening that route there is already hydrated data
  • I added selectors to show how they can be used in a redux app. Not really that necessary but gave some neatness to the app and allowed me to remove a lot of ternary operators from the render of CharacterDetails. Also speaks to the performance aspect of the spec due to reselect only recalculating when the redux state that it is using changes not when the component re-renders.
  • There is a bug with the pagination when returning from looking at a character it resets the page to 1 despite being on a different page. One way to resolve this is by putting the pagination state in to the store - something like state.ui.pagination or similar. I just ran out of time.
  • There is an issue where if you navigate to a different page, select a character, then refresh it will not have any details. One solution is to dispatch an action in componentWillMount or componentDidMount to fetch for a specific ID. I haven't implemented the appropriate actions etc. yet.

Comments on directory structure

The way I have set up the directory structure draws some inspiration from this post

Below paths are relative to src

Directory Purpose
components Re-usable components. Presentational or "dumb". These are shared between smart components
layout Components used to structure how the app looks at the higher level.
redux Contains all the 'modules' as well as the store creation and selectors. All redux related code goes here
routes This is where the router points to. The smart container component has no JSX and just connects the store to the components beneath it
routes/components These receive props from the container which are from redux (state & actions)

Routes

Route Component
Index Characters
/characters/:id Character

User flow

  1. Hit the Index route which renders the App component and it's child CharactersList. Upon app starting it has dispatched to API to get data.
  2. CharactersList shows the data once it has completed fetching.
  3. Clicking on a character link navigates to /characters/:id which will render the CharacterDetails component

jumbo-marvel's People

Contributors

patrickgordon avatar

Watchers

 avatar

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.