Git Product home page Git Product logo

erm's Introduction

Epam React Mentoring Readme file

Stack / tooling

Following tools are used in this project:

  • Reactjs
  • Typescript
  • Jest + Enzyme
  • Storybook

Project setup

Develepoment setup is rather simple. First install dependencies using npm i then run npm run dev. Webpack automatically watches and updates files. No webpack-dev-server is currently needed.

Testing

  • Unit Testing is set up under npm run test command. (for coverage npm run test:coverage) should be used.
  • Visual testing / documentation is set up under npm run storybook command

Building Project

npm run prod

Dev notes

to run project two npm scripts have to be called: npm run dev and npm run serve. These can be called separately or using npm start command. In future this will also run storybook and possibly testing.

Note: even though npm run dev runs webpack command, due to webpack config files being written in TypeScript it has to be run in node context, thus through npm run dev

View/ component structure

Redux setup

Actions and reducers are conteainer (view) wide. Everything is imported in index.ts from view components.

Redux State:

{
  SearchResults: {
    query: string;
    movies?: array;
    sorting: string;
    filter: string;
  },
  MovieDetails: {
    id: number;
    similarMovies: array;
  }
  fetching: {
    status: boolean,
    error: "false" | {}
  }
  UI: {
    spinner: true;
  }
}

erm's People

Contributors

okhy avatar

Watchers

 avatar James Cloos avatar

Forkers

alekniebla

erm's Issues

Meet SSR task requirements

  • Async actions, redux provides initial state from server
  • Server app handles query params to compute initial state
  • Route masking. Can be implemented, or mentee can switch to next.js for SSR
  • Code splitting for optimized performance. Goes OOTB with next.js

Do two SSR approaches

Fully rendered application on Server side and Template render and data etching on client side

Data fetching

All data fetches moved to actions & received from store by components

Testing Redux

Actions and reducers covered with unit tests (~60%+, can be amended by mentor

Reat-router testing

  • Testing Link components
  • Testing route rendering
    --- to fix: ---
  • checkPropTypes is not a function

App markup

Task passing requirements:

  • Markup is done with React Components
  • Use ErrorBoundary component for catching and displaying errors
  • Use smart/dumb components approach
  • 100% decomposition ( evaluated by mentor )

Own tasks / notes:

  • Use controlled input for smart request sending / validation / result suggestions

Meet testing requirements

  • 80% minimum coverage
  • snapshot testing
  • Functional testing with enzyme and jest
  • write at least one e2e test

  • self imposed >95% test coverage

Style Components

Style components either using CSS modules or Styled Components

  • Button
  • Header
  • Footer
  • Input
  • MovieSearch
  • MovieGrid
  • MovieGridItem

Add Logic to Button Component

it("... executes passed click action", () => {
const mockFn = jest.fn();
const wrapper = shallow();

wrapper.simulate("click");

expect(mockFn).toHaveBeenCalled();

});

Meet Routing requirements

  • Have 2+ pages which displays on different URLs
  • Implement displaying 404 page for all invalid URL
  • 404 page for all invalid URLs By default user lands on a new page with empty results state
  • When user performs a search on the page, change URL and show search results
  • When new user enters the site using direct link with search parameters - show search results

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.