Pull Request - Francisco Rafael Arce García#58
Conversation
| @@ -0,0 +1,2 @@ | |||
| REACT_APP_API_KEY=iSAbLNTnHlhG33VP27yEQDITzhxAZ1iZ | |||
There was a problem hiding this comment.
I recommend that you add this file to your .gitignore as this are api keys
There was a problem hiding this comment.
You pushed it? I can still see your .env config
| To get started, edit <code>src/App.js</code> and save to reload. | ||
| </p> | ||
| </div> | ||
| <React.Fragment> |
|
|
||
| function* doQuerySearch({ param = {} }) { | ||
| var q; | ||
| param.q===""||param.q===undefined||param.q===null? q="pato":q=param.q; |
There was a problem hiding this comment.
kinda
const q = !para.q ? "pato" : param.q;There was a problem hiding this comment.
if someone for some reason get in the search view without looking for something the "pato" search happen.
| componentDidMount() { | ||
| const { querySearch } = this.props; | ||
| querySearch({q:this.props.location.state.query}); | ||
| console.log(); |
| const { querySearch } = this.props; | ||
| querySearch({q:this.props.location.state.query}); | ||
| console.log(); | ||
| // |
| super(props); | ||
| this.state = { | ||
| buttonText: "Fav", | ||
| fav: false |
There was a problem hiding this comment.
I think that you are replicating Redux store with the state. redux store should be the only source of true. Plus, If you can avoid states in your components would be better. (States only should be used for little things).
| return ( | ||
| < React.Fragment > | ||
| <Wraper onClick = {this.onClick}> | ||
| <ImgStyled src={require("./"+this.state.buttonText+".png")} /> |
There was a problem hiding this comment.
One is a heart button and the other one is the gif
| class Navbar extends Component { | ||
| constructor(props) { | ||
| super(props); | ||
| this.state = { |
There was a problem hiding this comment.
Why are you using a state here if you don't update it
There was a problem hiding this comment.
I update it when I write in my input
| import styled from 'styled-components' | ||
|
|
||
| export const UlStyled=styled.ul` | ||
| { |
|
|
||
| exports[`Styled gif works 1`] = ` | ||
| <div | ||
| className="sc-bdVaJa jbzoYE" |
There was a problem hiding this comment.
use jest-styled-components for the snapshot.
| @@ -0,0 +1,9 @@ | |||
| import React from 'react' | |||
| import renderer from 'react-test-renderer' | |||
| background-color: #333; | ||
| ` | ||
| export const LiStyled=styled.li` | ||
| { |
| import Fav from "../Containers/FavPage"; | ||
| import Search from "../Containers/SearchPage"; | ||
|
|
||
| const Routes = () => { |
There was a problem hiding this comment.
Try to change into dynamic routing mindset, in this case every route is at the same index but defining your routes on a separate file before anything renders is reinforcing static practices.
As your application grow larger it might not make a lot of sense to isolate routes this way.
There was a problem hiding this comment.
:D I will work on that. Thanks for your feedback
| const Routes = () => { | ||
| return ( | ||
| <React.Fragment> | ||
| <Switch> |
| <React.Fragment> | ||
| <UlStyled> | ||
| <LiStyled> | ||
| <NavLink to="/">Home</NavLink> |
| <NavLink to="/">Home</NavLink> | ||
| </LiStyled> | ||
| <LiStyled> | ||
| <NavLink to="/fav">Favs</NavLink> |
| export function addFav(params) { | ||
| return { | ||
| type: ADD_FAV, | ||
| params |
There was a problem hiding this comment.
The related data of an action should be contained in a payload attribute.
There was a problem hiding this comment.
ok. I'll consider it next time.
| } | ||
|
|
||
| onClick() { | ||
| if (this.props.gif.length > 0) { |
There was a problem hiding this comment.
You can avoid this state management leveraging the fav logic to the store.
| ) | ||
| ) | ||
|
|
||
| store.runSaga = sagaMiddleware.run |
There was a problem hiding this comment.
It is a bad practice to 'enhance' the store this way. Calling runSaga on the saga middleware is a better approach.
There was a problem hiding this comment.
Ok. Thanks for your feedback.
No description provided.