Questions tagged [recompose]

Recompose is a React utility belt for function components and higher-order components. Think of it like lodash for React.

Recompose is a React utility belt for function components and higher-order components. Think of it like lodash for React.

You can use Recompose to

  • lift state into functional wrappers
  • perform the most common React patterns
  • optimize rendering performance
  • interoperate with other libraries
  • build your own libraries

Useful Links

Related tags

192 questions
5
votes
3 answers

React Recompose Causing Typescript Error On Props

I have a very basic stateful component where I'm using recompose to add multiple HOC to my component (in my example I only use one for simplicity). For some reason typescript is giving me an error regarding my props going into my component. How can…
Jon Lamb
  • 1,413
  • 2
  • 16
  • 28
5
votes
1 answer

Only add HoC if certain condition is met in the props

I am using the recompose library and HoCs to pass down a bunch of props for my component. I'd like to know if there is a way, within the compose to check for props before setting up an HoC. For example, say I have something like this: export default…
theJuls
  • 6,788
  • 14
  • 73
  • 160
5
votes
1 answer

Property does not exist on React component when defined with recompose

I'm using create-react-app with the typescript scripts as a base, trying to get a simple example working with recompose. The problem is I can't send down a property directly to the component. I've created a simple User component…
Simon
  • 496
  • 4
  • 19
5
votes
2 answers

Defining function for withHandler in Recompose for React

All of the examples I look at, the function actually called in withHandlers seems to call a function from props, but I have no idea how that function is defined. Here is a small example from docs for humans. compose( withState('count', 'setCount',…
Nick Brady
  • 6,084
  • 1
  • 46
  • 71
5
votes
1 answer

How implement toggle with Rxjs

I am learning rxjs. I create decorator "toggleable" for Dropdown component. All work fine, but I don't like it. How can I remove condition "toggle/hide". Uses rxjs, react.js, recompose. It's toogleable decorator for Dropdown component. export const…
nonlux
  • 774
  • 2
  • 6
  • 20
5
votes
2 answers

Using branch from recompose

I am refactoring a stateless functional component to use branch and renderComponent from recompose. The original component looks like this: const Icon = props => { const { type, name } = props let res if (type === 'font') { return…
vamsiampolu
  • 6,328
  • 19
  • 82
  • 183
5
votes
2 answers

WithProps vs withHandlers

I've been looking at react recompose library and trying to grasp difference here, result is the same, tried to read docs, but got even more confused, why there is two ways to do same thing ? const enhance = compose( withState('counter',…
Polisas
  • 491
  • 1
  • 9
  • 20
5
votes
2 answers

Recompose "withReducer": justification of async reducer function call

I'm using withReducer HOC and noticed this behaviour: Calling this on click handler for example: import React from 'react' import { withReducer } from 'recompose' import { compose } from 'ramda' export default compose( withReducer('state',…
Komlev
  • 51
  • 2
5
votes
1 answer

How can I access the ref of the BaseComponent or any level of the components?

Original question: https://github.com/acdlite/recompose/issues/232 How can I access the ref of the BaseComponent or any level of the components? Code: class BaseComponent { doSth(){...} } const Component compose(...some)(BaseComponent); class…
Fernando Montoya
  • 2,625
  • 1
  • 18
  • 21
4
votes
2 answers

How to call another function from withHandlers?

I am trying to implement google maps in my app using react-google-maps package. In map, I am showing multiple Marker and used MarkerCluster. Until now I have no issue and easily implemented from the doc. But now I want to show InfoWindow if the…
Gaurav Kumar
  • 1,111
  • 6
  • 25
  • 52
4
votes
1 answer

Using a higher order component to add event listeners per component

I have some components in my app which are expected to handle some user inputs from the keyboard. For that I created the following function: export default function withKeydownEventHandler (handler) { id = id + 1 return lifecycle({ …
theJuls
  • 6,788
  • 14
  • 73
  • 160
4
votes
1 answer

Recompose and Apollo Query

Is it possible to use Recompose for the Query component of react-apollo? https://www.apollographql.com/docs/react/essentials/queries.html#basic I was thinking of something like this: const props = {component:"Query", query: gql(ListResults),…
stampede76
  • 1,521
  • 2
  • 20
  • 36
4
votes
0 answers

Advantages of using componentFromStream

What are the advantages of using componentFromStream? and in which case use it? some examples? Thanks a lot
Gabriel
  • 41
  • 3
4
votes
2 answers

How to get React/recompose component updated when props are changed?

I'm writing this product list component and I'm struggling with states. Each product in the list is a component itself. Everything is rendering as supposed, except the component is not updated when a prop changes. I'm using recompose's…
Gustavo Straube
  • 3,744
  • 6
  • 39
  • 62
4
votes
1 answer

Using [key:string]: any to avoid needing an extra function for generics?

I am using recompose in React, in particular its compose function which has a signature of function compose( ...functions: Function[] ): ComponentEnhancer; interface ComponentEnhancer { …
Matt Greer
  • 60,826
  • 17
  • 123
  • 123
1
2
3
12 13