
Research
Malicious npm Packages Impersonate Flashbots SDKs, Targeting Ethereum Wallet Credentials
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
recompose-relay-modern
Advanced tools
This is a HOC for relay modern to work with сomposable react components.
You probably want to use this when you work with smart and dumb components and you need to compose relay data fetching in your smart component and pass it down to dumb component.
npm install --save recompose-relay-modern
Set relay environment using setEnvironment
in your enty point. For example in client.js
:
import { setEnviroment } from 'recompose-relay-modern';
import relayEnv from './createRelayEnvironment'
setEnviroment(relayEnv);
And now you are ready to use it.
import {
graphql,
} from 'react-relay';
import { fragmentContainer } from 'recompose-relay-modern';
import Persons from './Persons';
export default compose(
fragmentContainer(graphql`
fragment PersonsContainerDesc on Person @relay(plural: true) {
id
title
}
`),
connect(mapProps, mapDispatch, mergeProps),
)(Persons);
import {
graphql,
} from 'react-relay';
import { queryRenderer } from 'recompose-relay-modern';
import PersonsInfoPage from './PersonsInfoPage';
import { PersonsContainer } from '../Persons';
export default compose(
queryRenderer(graphql`
query PersonsInfoPageContainerQuery {
Person {
...PersonsContainerDesc
}
}
`),
mapProps(props => ({
persons: <PersonsContainer data={props.Person} />,
})),
)(PersonsInfoPage);
import { createMutation } from 'recompose-relay-modern';
export default compose(
mapProps(props => ({
onSubmit: (data) => {
createMutation(graphql`
mutation MyComponentContainerMutation($input: MyInput!) {
createUser(input: $input) {
clientMutationId
}
}
`, { input: data }).then(res => console.log(res);
},
})),
reduxForm({
form: 'MyForm',
}),
)(MyForm);
import { queryRenderer, refetchContainer } from 'recompose-relay-modern';
export default compose(
queryRenderer(graphql`
query appQuery {
viewer {
...Test_viewer
}
}
`),
refetchContainer(
{
viewer: graphql.experimental`
fragment Test_viewer on User
@argumentDefinitions(
name: { type: String }
) {
id
firstName
lastName
}
`,
},
graphql.experimental`
query TestQuery($name: String!) {
viewer {
...Test_viewer @arguments(name: $name)
}
}
`,
),
)(Test);
import { queryRenderer, paginationContainer } from 'recompose-relay-modern';
export default compose(
queryRenderer(
query songsContainerQuery(
$count: Int!
$cursor: String
) {
...songsContainer
}
`),
paginationContainer(
fragment songsContainer on Query {
songs(
first: $count,
after: $cursor,
) @connection(key: "songsContainer_songs") {
edges {
node {
audioId,
name,
coverImageUrl,
artist,
likes,
dislikes,
}
}
}
}
`),
{
direction: 'forward',
query: graphql`
query songsContainerForwardQuery(
$count: Int!
$cursor: String
) {
...songsContainer,
}
`,
getVariables: (_, { count, cursor }) => ({
count,
cursor,
}),
}),
)(Test);
FAQs
Recompose helpers for Relay Modern.
We found that recompose-relay-modern demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.
Security News
Ruby maintainers from Bundler and rbenv teams are building rv to bring Python uv's speed and unified tooling approach to Ruby development.
Security News
Following last week’s supply chain attack, Nx published findings on the GitHub Actions exploit and moved npm publishing to Trusted Publishers.