choojs / choojs/hyperx

How to pass function as child?

Open
#71 7 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
1k
Forks
45
PR merge metrics
No merged PRs in 30d

Description

:wave: hi, wondering how to pass a function to a component. Trying to use the `Query` component from `react-apollo`.

```js
const hyperx = require('hyperx');
const { Query } = require('react-apollo');
const gql = require('graphql-tag');
const { createElement } = require('react');

const hx = hyperx(createElement);

hx`<${Query}
query=${gql`
{
// query here
}
`}
>
${({ loading, error, data }) => {
// function content here
}}
`
```

Returns:
```
Failed prop type: Invalid prop `children` of type `array` supplied to `Query`, expected `function`.
in Query
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.