Giter Site home page Giter Site logo

rejection's Issues

Mid level completed.

Here is the link to the app.

https://github.com/janhesters/rejection-game

It's a private repo, but I invited you both as collaborators.

Also, if you happen to download the repo, you can search for NOTEs in the code. I used NOTE every time I wasn't sure / had a question ๐Ÿ˜Š

Things that could be improved (from the top of my head):

  • Design & UI (duh).
  • Offline experience. (If I hadn't used Redux Saga, but AWS Amplify, this would be just gifted to you for free by Amplify.)
  • E2E tests with Cypress.

Things I'm working on:

  • CI / CD + automatic production deploy.

Basic Level completed!

Finish basic level using Next.js + React + Redux with TDD.

Architecture

1. ducks pattern

Colocate constants, action creators, and selectors with reducer.

2. 10 Tips for Better Redux Architecture

Use TDD: Write Tests First
  • Direct reducer tests: Test that the reducer produces the expected default state.
  • Action creator tests: Test each action creator by applying the reducer to the action using some predetermined state as a starting point.
  • Selector tests: Tests the selectors to ensure that all expected properties are there, including computed properties with expected values.

3. Feature-based file structures

Questions

1. Constants naming principle

Duck pattern say that MUST have action types in the form npm-module-or-app/reducer/ACTION_TYPE

But I notice you use const ADD_CHAT = 'CHAT::ADD_CHAT'

Which pattern should I follow?

2. Where is the describe come from?

describe('chatReducer()', ({ test }) => {
  test('with no arguments', ({ same, end }) => {
    const msg = 'should return correct default state';

    const actual = reducer();
    const expected = createState();

    same(actual, expected, msg);
    end();
  });
});

3. Is this a correct way to load data from localStorage?

componentDidMount() {
  const { dispatch } = this.props;
  const serializedState = localStorage.getItem('rejection/state');
  const state = JSON.parse(serializedState) || {};
  if (state.asks) state.asks.map(ask => dispatch(addAsk(ask)));
}

Challenge completed level: basic

site: https://rejection.manos.now.sh/
repo: https://github.com/mfountoulakis/rejection

This was a great exercise! You left a trail of easter eggs leading right to some really nice tips about testing the redux store.

I could have submitted this exercise a lot earlier if I hadn't run into issues with testing. Specifically, unit testing connected components. The short answer is: I don't know what I'm doing.

mapStateToProps seems to be clashing with the simulated state that I'm attempting to pass to my components as props. I suspect that there's an easy solution that I'm missing here, but I will continue to write tests in other areas in the meantime, along with general refactoring.

As always, questions/comments are welcome!

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.