This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Show hidden characters
| { | |
| "compilerOptions": { | |
| "module": "commonjs", | |
| "target": "ES2015", | |
| "sourceMap": true | |
| }, | |
| "include": ["index.ts"], | |
| "exclude": ["node_modules"] | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var binarySearch = function (array, target) { | |
| var guess, min = 0, max = array.length - 1; | |
| while(min <= max) { | |
| guess = Math.floor((min + max) / 2); | |
| if(array[guess] === target) { | |
| return guess; | |
| } else if(array[guess] < target) { | |
| min = guess + 1; | |
| } else { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var binarySearch = function (array, target) { | |
| var guess, min = 0, max = array.length - 1; | |
| while(min <= max) { | |
| guess = Math.floor((min + max) / 2); | |
| if(array[guess] === target) { | |
| return guess; | |
| } | |
| } | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var binarySearch = function (array, target) { | |
| var guess, min = 0, max = array.length - 1; | |
| }; | |
| var index = binarySearch([1, 2, 3, 4, 5], 4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { connect } from "react-redux"; | |
| import { actionCreators as procutsActions } from "redux/modules/products"; | |
| import Container from "./container"; | |
| const mapStateToProps = (state, ownProps) => { | |
| const { products: { items } } = state; | |
| const { routing: { location } } = state; | |
| return { | |
| location: location.pathname, | |
| items |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { connect } from "react-redux"; | |
| import { actionCreators as procutsActions } from "redux/modules/products"; | |
| import Container from "./container"; | |
| const mapStateToProps = (state, ownProps) => { | |
| const { products: { items } } = state; | |
| return { | |
| items | |
| }; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from "react"; | |
| import data from "MOCK_DATA.json"; | |
| import App from "./presenter"; | |
| class Container extends Component { | |
| constructor() { | |
| super(); | |
| this.state = { | |
| products: [], | |
| cart: [], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React, { Component } from "react"; | |
| import { Route, Switch } from "react-router-dom"; | |
| import Nav from "components/Nav/Nav"; | |
| import Cart from "components/Cart/Cart"; | |
| import Main from "components/Main/Main"; | |
| import Item from "components/Item/Item"; | |
| class App extends Component { | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import React from "react"; | |
| import ReactDOM from "react-dom"; | |
| import App from "components/App"; | |
| import { Provider } from "react-redux"; | |
| import { ConnectedRouter } from 'react-router-redux'; | |
| import store, { history } from 'redux/configureStore'; | |
| ReactDOM.render( | |
| <Provider store={store}> | |
| <ConnectedRouter history={history}> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import { combineReducers, createStore, applyMiddleware } from "redux"; | |
| import thunk from "redux-thunk"; | |
| import { routerReducer, routerMiddleware } from "react-router-redux"; | |
| import products from "redux/modules/products"; | |
| import createHistory from "history/createBrowserHistory"; | |
| import { composeWithDevTools } from "redux-devtools-extension"; | |
| const env = process.env.NODE_ENV; | |
| const history = createHistory() |