export const GET_CRYPTOS= 'GET_CRYPTOS'
export const fetchCryptos = async () =>{
request.get("https://api.coinmarketcap.com/v1/ticker/?limit=10")
.then(res => dispatch({
type: GET_CRYPTOS, payload: res.body})
})
)
render() {
return <button onClick={this.press} className={this.state.class}>{this.state.class==="on"?'нажми еще раз':'Нажми'}</button>;
}
case ADD_PRODUCT:
console.log(state,action.product)
return
{ ...state.prodacts,
products: [...state.product, {'id':9999,'title_fin':action.product}]
}
case ADD_PRODUCT:
let products = state.products
products.push(action.product)
return
{ ...state.products,
products
}
делайте dispatch
импортируйте данные в компоненте и выводите их