# get-loadables-and-graphql

> Graphql data and loadables loader.

Latest version **1.0.3** (published 2018-07-16) · ISC license · 0 weekly downloads

## Install

```sh
npm install get-loadables-and-graphql
pnpm add get-loadables-and-graphql
yarn add get-loadables-and-graphql
bun add get-loadables-and-graphql
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2018-07-16 |
| First published | 2018-07-16 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 5.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ajith K S |
| Maintainers | ajith.sakharia |
| Keywords | graphql, react, loadables, ssr |

## Links

- npm: https://www.npmjs.com/package/get-loadables-and-graphql
- Repository: https://github.com/ajithAPER/get-graphql-and-loadables
- Homepage: https://github.com/ajithAPER/get-graphql-and-loadables#readme
- Issues: https://github.com/ajithAPER/get-graphql-and-loadables/issues
- npm.io page: https://npm.io/package/get-loadables-and-graphql

## Dependencies (6)

- [react](https://npm.io/package/react.md) ^16.4.1
- [graphql](https://npm.io/package/graphql.md) ^0.13.2
- [react-dom](https://npm.io/package/react-dom.md) ^16.4.1
- [react-apollo](https://npm.io/package/react-apollo.md) ^2.1.9
- [apollo-client](https://npm.io/package/apollo-client.md) ^2.3.5
- [loadable-components](https://npm.io/package/loadable-components.md) ^2.2.2

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2018-07-16
- 1.0.2 — 2018-07-16
- 1.0.1 — 2018-07-16
- 1.0.0 — 2018-07-16

## README

[![npm](https://img.shields.io/npm/v/get-loadables-and-graphql.svg)](https://www.npmjs.com/package/get-loadables-and-graphql)


Package was built to have unanimous capability to use react-apollo and loadable-components while approaching ssr.

Follow setups required for [react-apollo](https://www.npmjs.com/package/react-apollo) and [loadable-components](https://www.npmjs.com/package/loadable-components).

## Install using:

```sh
npm install get-loadables-and-graphql
```


## After having followed setup for react-apollo and loadable-components
```jsx
import GetLoadableAndGraphqlData from 'get-loadables-and-graphql';

// Code needed - middlewares
const appComponent = (
  <ApolloProvider client={ apolloClient }>
    <App
      />
  </ApolloProvider>
);

const loadableScripts = await GetLoadableAndGraphqlData( appComponent );
const app = ReactDOM.renderToString( appComponent );
const initialState = apolloClient.extract();

const html  = `
  <html>
    <body>
      <script
        dangerouslySetInnerHTML={ {
          __html: this.props.loadableScripts,
        } }
        />
      <script
        dangerouslySetInnerHTML={ {
          __html: `window.__APOLLO_STATE__=${ JSON.stringify( this.props.initialState ).replace( /</g, '\\u003c' ) };`,
        } }
        />
    </body>
  </html>
`;
```

---
_Source: https://npm.io/package/get-loadables-and-graphql · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
