In this lesson we'll create our initial components using the architecture we've built so far.
hi, I just curious why sometimes you use es6 class to define the component, and sometimes you just using export default for the component?
i.e: export default (props) => { return ( <div className="col-xs-6 col-sm-4 col-md-3"> <p>{props.item.cost}</p> </div> ) }
why? plz advise.
React 0.14.x can render a function as a component. It is treated like the render
method on a Component
https://egghead.io/lessons/react-building-stateless-function-components-new-in-react-0-14
Why are the action methods called with bind? AppActions.addItem.bind(null, props.item) instead of AppActions.addItem(props.item)
This is a common JS, not React specific, practice that allows us to pass the function to the child component along with arguments, but letting the child component execute the function when appropriate. AppActions.addItem(props.item) would execute immediately, and in this app, perpetually.
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind
in app-store.js , _findCart(item) function should return the cartItem :
const _findCartItem = (item) => { return _cartItems.find(cartItem => cartItem.id === item.id); };
this will help during add item. by not returning, it will create new table record instead of just incrementing the item.qty
I have some issue Object.assign ? how to resolve this
I have some issue Object.assign not a function ? how to resolve this
I also have an issue with Object.assign where it throws and error into console "Uncaught TypeError: undefined is not a function" and doesn't render app