Coder Social home page Coder Social logo

mackentoch / react-redux-graphql-apollo-bootstrap-webpack-starter Goto Github PK

View Code? Open in Web Editor NEW
126.0 17.0 33.0 5.64 MB

react js + redux + graphQL + Apollo + react router + hot reload + devTools + bootstrap + webpack starter

Home Page: https://mackentoch.github.io/react-redux-graphql-apollo-bootstrap-webpack-starter

JavaScript 100.00%
reactjs redux apollo-client graphql webpack bootstrap react react-router scaphold react-router-v4

react-redux-graphql-apollo-bootstrap-webpack-starter's People

Contributors

mackentoch avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-redux-graphql-apollo-bootstrap-webpack-starter's Issues

Throw error when run: npm run start

Hello, i did a fresh install with the last version from Master branch using Node 8.11 and when i try start up the application throw the next error.

ERROR in ./src/front/index.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
SyntaxError: Unexpected token (33:4)

  31 | const renderApp = RootComponent => {
  32 |   render(
> 33 |     <AppContainer warnings={false}>
     |     ^
  34 |       <RootComponent />
  35 |     </AppContainer>,
  36 |     // $FlowIgnore

Any idea about this ?

styles in css for SSR

as soon as I do import styles from './styles.css';ssr is not working anymore. Anyone already faced that problem before?

State Not Found

When you run the command

npm run dev

In the frontend the console throw:

loadable-components state not found. You have a problem server-side. Please verify that you have called loadableState.getScriptTag() server-side.

Looks like the server render can't create the initial state.

How to handle assets dev/prod?

Hi there,

I really like your boilerplate. Thanks a lot (:

The only weird thing I've noticed is how prod bundle is done. Where should I put my static files, like images, fonts?

At first I put at public folder, but then noticed that the bundle wasn't loading my assets. Also, I find it really weird that there is a index.html that is static, not copied from root folder in webpack bundle.

Did I missed something?

Thanks

Register User

I have this error when i try to test register user from app:
GraphQL error: User is not permitted to access mutation: createUser

Concepts: Dynamic gql, pass down as props

I want to discuss some concepts about ability to use/switch to multiple gql query while connecting it to the same component. What I meant was something like this:
http://dev.apollodata.com/react/api-graphql.html#graphql-config-skip

export default compose(
  graphql(gql`query MyQuery1 { ... }`, { skip: props => !props.useQuery1 }),
  graphql(gql`query MyQuery2 { ... }`, { skip: props => props.useQuery1 }),
)(MyComponent);
function MyComponent({ data }) {
  // The data may be from `MyQuery1` or `MyQuery2` depending on the value
  // of the prop `useQuery1`.
  console.log(data);
}

However, this still seems very static, and "declarative". Consider you have 2 very similar Scroll components, that has exactly the same type of View. One lists the top 100 movies, the other lists all movies matching a given set of movie Director names. The only difference here would be the gql queries, and query variables for them. It'd be nice to pass the gql query down as props.

Consider these 2 views: IndexView, MoviesView.

The way i consume the dynamic gql query and connect it to the component is to create a wrapper component like this. (In comments)

const MoviesWithCusorWrapper = (props) => {
  const { gql = moviesQuery } = props;
  const Comp = compose(graphql(gql, gqlConfig), withLoading)(Movies);

  return React.createElement(Comp, props);
};

or to simplify it further (without the added recompose and gqlConfig options, only the idea of the Wrapper Component):

const MoviesWrapper = (props) => {
  const Comp = graphql(props.gql)(Movies);

  return React.createElement(Comp, props);
};

I've abstracted the wrapper component as a HOC to something like this:

import React from 'react';
import _ from 'lodash';
import { compose } from 'recompose';
import { graphql } from 'react-apollo';

const withGqlPropsHOC = (gqlDefault, { enhancers, gqlConfig }) => Comp => (props) => {
  const { gql = gqlDefault } = props;
  // preppedEnhancers takes care of undefined, single parameter, array of enhancers
  const preppedEnhancers = _.compact(Array.isArray(enhancers) ? enhancers : [enhancers]);
  const EnhancedComp = compose(graphql(gql, gqlConfig), ...preppedEnhancers)(Comp);

  return React.createElement(EnhancedComp, props);
};

export default withGqlPropsHOC;

so we can use it like this:

export default
withGqlProps(moviesQuery, { enhancers: [withLoading], gqlConfig })(Movies);

Which results in 2 different query by passing it down as props,
image
image

Is there already something similar provided by apollo-core/apollo libraries? Any thoughts?

NPM install throws a lot of peer dependency warnings

When I hit NPM install to install this package, I get the following errors:

npm ERR! Darwin 16.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer [email protected] wants [email protected] || 15.* || ^15.0.0
npm ERR! peerinvalid Peer [email protected] wants react@>=0.14.0
npm ERR! peerinvalid Peer [email protected] wants react@^15.5.4
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0
npm ERR! peerinvalid Peer [email protected] wants react@>=0.13.2 || ^0.14 || ^15.0.0
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0-0 || ^15.4.0-0 || ^16.0.0-0
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.0 || ^15.0.0
npm ERR! peerinvalid Peer [email protected] wants react@^15.4.0-0
npm ERR! peerinvalid Peer [email protected] wants [email protected] || 0.14.x || ^15.0.0-0 || 15.x
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.9 || ^15.3.0
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.9 || ^15.3.0
npm ERR! peerinvalid Peer [email protected] wants react@^0.14.9 || ^15.3.0

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/koenhoutman/hashtracks/ui/npm-debug.log

So maybe it's a good idea to check up on the versioning of all the node modules. Have been unable to solve this yet.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.