Skip to content

Conversation

@j-polanco
Copy link
Owner

@j-polanco j-polanco commented Mar 25, 2021

Acceptance Criteria

https://gist.github.com/jparciga/2c2375835ea5e26ba3bc2bd6a30f0ee5

Changes

  • Made big refactor in the application
  • Add router mechanism
  • Delete missing files
  • create constant
  • fetch data changing approach
  • Move Card into a component instead of page folder

Demo

https://priceless-wescoff-41c153.netlify.app/

- Add router
-  Delete missing files
- create constant
- fetch data changing approach
- Move Card into a component instead of page folder
@j-polanco j-polanco changed the title - Made big refactor in the application Mini - Challenge 5 Mar 25, 2021
overflow: hidden;
`;

const StyledLink = styled(Link)`

Choose a reason for hiding this comment

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

Good use of the extend styles feature from styled-components!

`;

const Styled = {
Link: StyledLink,

Choose a reason for hiding this comment

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

You can directly add this to the export statement.


function ModalLogin({ show }) {
const { data, dispatch } = useData();
const [userName, setUserName] = useState(undefined);

Choose a reason for hiding this comment

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

Leaving the useState() blank without any param is the save as saying useState(undefined). What I do in the case of an input is initializing the state to an empty string like useState('').

function ModalLogin({ show }) {
const { data, dispatch } = useData();
const [userName, setUserName] = useState(undefined);
const [password, setPassword] = useState(undefined);

Choose a reason for hiding this comment

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

Same comment as above.

}

function handlerLogin() {
console.log(data);

Choose a reason for hiding this comment

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

Remember to delete this for production or real-life scenarios 😝 .

return (
<div>
{data.loginUser ? (
''

Choose a reason for hiding this comment

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

In this case, instead of an empty string, it's better to use null.

}

return (
<div>
Copy link

@guillermo-rebolledo guillermo-rebolledo Apr 7, 2021

Choose a reason for hiding this comment

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

Instead of using an extra div here to suffice to React constraints of wrapping code in one container, you can use React Fragmens so that we don't necessarily add an extra node to the DOM.

You can either say:

<React.Fragment>
    {your code here}
</React.Fragment>

Or you can import Fragment from React:

import { Fragment } from 'react';
...
<Fragment>
    {your code here}
</Fragment>

Or take advantage the syntactic sugar and use:

<>
    {your code here}
</>


export default function Routes() {
return (
<>

Choose a reason for hiding this comment

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

A Fragment <></> is not necessary here since Switch is wrapping the whole block of code/nodes.

JSON.stringify(Array.from(favorites.entries()))
);
} else {
console.log(

Choose a reason for hiding this comment

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

In a real-life scenario it would make sense to also handle errors in the UI so the user is aware of it!

Copy link

@guillermo-rebolledo guillermo-rebolledo left a comment

Choose a reason for hiding this comment

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

Great work @j-polanco !

Solid work here! The only comments that I made were minor things. I know it is a smaller thing and it works as it is, but maybe we can improve the styles of the page too 🎨..

Other than that:

  • Good use of styled-components and its features and APIs. 💅🏼
  • Good use of React hooks and good to see you made your own. 🔥
  • Good understanding of state management. ⌛
  • Good practices overall (naming, reusing code, etc.) 👍🏼

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