The ability to reply to discussions is limited to PRO members. Want to join in the discussion? Click here to subscribe now.

Flux Architecture: Components/Views

Flux Architecture: Components/Views

9:11
In this lesson we'll create our initial components using the architecture we've built so far.
Watch this lesson now
Avatar
egghead.io

In this lesson we'll create our initial components using the architecture we've built so far.

Avatar
jackyon

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 (

{props.item.cost}

)
}

why? plz advise.

Avatar
Joel

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

In reply to jackyon
Avatar
Altug

Why are the action methods called with bind?
AppActions.addItem.bind(null, props.item)
instead of
AppActions.addItem(props.item)

Avatar
Joseph

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 reply to Altug
Avatar
Vivek Agarwal

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

Avatar
zainul

I have some issue Object.assign ? how to resolve this

Avatar
zainul

I have some issue Object.assign not a function ? how to resolve this

Avatar
Mihail

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

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?