Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor: STEP 2 mapStateToProps HOC to hook useSelector to get state (Admin) #1327

Closed
nphivu414 opened this issue May 25, 2020 · 1 comment · Fixed by #1361
Closed

Refactor: STEP 2 mapStateToProps HOC to hook useSelector to get state (Admin) #1327

nphivu414 opened this issue May 25, 2020 · 1 comment · Fixed by #1361
Assignees
Labels
feature New feature or request front-end Relates to front end issues marketplace Relates to the Marketplace

Comments

@nphivu414
Copy link
Contributor

Background context or User story:

  • Some places we're getting the data from the state like the example below
    image
  • For the new version of react we can use hooks to get data via selector like image below
    image

Specification or Acceptance Criteria:.

  • Replace the way to get data from components from mapStateToProps to use useSelector hooks
  • How to test.
  1. Mock a global Redux store placing in core/__mocks__/store.ts
  2. Use the mock store in core/__mocks__/store.ts for mock store like this
    image
  • Where should we place the selector?.
    We'll input selector to /src/selector/ folder and we'll have 3 files developer.ts, client.ts and admin.ts. We'll put the selector which use for a developer to developer file ...
  • How to name selector?.
    We'll name it as select<> in the redux state tree.

Suggested solution:

  • Move the way to get data from state directly to use and get data via selector
  • Mock global state to core/__mocks__/store.ts
@nphivu414 nphivu414 added feature New feature or request marketplace Relates to the Marketplace front-end Relates to front end issues labels May 25, 2020
@nphivu414 nphivu414 added this to the Marketplace v2.0 milestone May 25, 2020
@duong-se duong-se self-assigned this May 25, 2020
duong-se added a commit that referenced this issue May 27, 2020
Changes
- refactor admin apps pages
- fix test
duong-se added a commit that referenced this issue May 27, 2020
Changes
- refactor admin apps pages
- fix test
duong-se added a commit that referenced this issue May 27, 2020
Changes
- refactor admin apps pages
- fix test
ant066 pushed a commit that referenced this issue May 29, 2020
ant066 pushed a commit that referenced this issue Jun 1, 2020
@duong-se
Copy link
Contributor

duong-se commented Jun 3, 2020

Verified on dev
http://recordit.co/hPgn0Gf2t7.gif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request front-end Relates to front end issues marketplace Relates to the Marketplace
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants