Skip to content

React redux task#5

Open
prokhorovd wants to merge 47 commits into
masterfrom
react-redux
Open

React redux task#5
prokhorovd wants to merge 47 commits into
masterfrom
react-redux

Conversation

@prokhorovd
Copy link
Copy Markdown
Owner

No description provided.

fix: provide case for empty search value
fix: fix total number of news calculation
fix: searchValue and value of search field are separated
fix: disable -next- button on empty page
refactor: few cosmetic details
refactor: remove unnecessary types
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
let value = '';
if (typeof data[1] === 'string') {
value = data[1].toString();
} else if (typeof data[1] === 'object' && data[1] !== null) {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

without types, it looks very complicated and confusing. Consider refactoring

Comment thread src/features/feed/Feed.tsx Outdated
Comment thread src/features/feed/feedSlice.tsx Outdated
Comment thread src/features/feed/feedSlice.tsx Outdated
Comment thread src/features/feed/feedSlice.tsx Outdated
Comment thread src/helpers.tsx Outdated
Comment thread src/components/ArticleBox.tsx Outdated
data: ArticleInfo
}

function objFlatter(obj: {[index: string]:any}, prefix = ''): object {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

зачем это нужно?)

Comment thread src/components/ArticleBox.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/Details.tsx Outdated
Comment thread src/components/News.tsx Outdated
Comment thread src/features/feed/feedSlice.tsx Outdated
pageSize: 100,
sortBy: 'publishedAt',
id: '',
searchValue: query.get('searchValue'),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can create const with params to avoid magic strings) but up to you

const queryParams = {
  searchValue: 'searchValue',
  sortBy: 'sortBy',
  ...
};

...

const linkParams: Args = {
  [queryParams.searchValue]: query.get(queryParams.searchValue),
  ...
};

Comment thread src/components/Details.tsx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants