Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
programmatic-query
Advanced tools
Alternative Query
component for react-apollo
to make manually fired queries less painful.
See the example use case different between react-apollo
and programmatic-query
here.
Install
yarn add programmatic-query
# or
npm install programmatic-query
Usage
import { Query } from "programmatic-query";
Query
component from react-apollo
Query
PropsThe follow props are identical in use to the Query
component in react-apollo
:
skip
query
variables
onError
onCompleted
errorPolicy
fetchPolicy
Read more about these props here.
children
- function
A render prop to return a UI based on the query executed on component mount.
Configurable to allow the execution of the query to be handled by a seperate event other than the component mount.
To switch between the result only and with query handler behavior, pass a parameter name for the query handler to allow the query to be fired when the handler is invoked. Otherwise to use the default behavior, omit the second render prop argument and the query will be fired on component mount.
Query is fired immediately upon component mount with any passed configuration to the Query component:
const App = () => (
<Query
query={gql`
{
allTodos {
id
text
}
}
`}
>
{({ data, error, loading, networkStatus }) => (
<Component>
{data && data}
{error && error}
{loading && "Loading.."}
</Component>
)}
</Query>
);
See children
prop here
const App = () => (
<Query
query={gql`
{
allTodos {
id
text
}
}
`}
>
{({ data, error, loading, networkStatus }, fetchAllTodos) => (
<Component>
{data && data}
{error && error}
{loading && "Loading.."}
<Button onPress={() => fetchAllTodos()}>Fetch All Todos</Button>
</Component>
)}
</Query>
);
fetchOnMount
- boolean
Specify if the query is fired on component mount even when a query handler is passed. Useful to easily fetch data on load, and allow a refetch via the query handler.
Uses the variables
passed as the query prop as the variable
argument.
FAQs
Query component for programmatic react-apollo queries.
We found that programmatic-query demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.