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
3
votes
2 answers

How to create React's new static function getDerivedStateFromProps as a lifecycle method using an HoC in the recompose library?

Recently it has come out that soon React will be deprecating componentWillReceiveProps and in it's place is the new static function getDerivedStateFromProps. See more here I am currently migrating my apps to this new API, but am having an issue…
theJuls
  • 6,788
  • 14
  • 73
  • 160
3
votes
0 answers

Text-based and bounds-based searching with react-google-maps

I'm using react-google-maps to add a map with search functionality that shows nearby, fetched POI's as markers and renders a list of those places below it (a-la Airbnb). This related question covered the majority of what I was aiming for, but I…
3
votes
3 answers

Is it Possible to Rename Recompose HOC (For Better Stack Traces)?

I love recompose, but when I use it I wind up with stack traces that have lines like: in withProps(withHandlers(withHandlers(SelectionOverlay))) (created by withState(withProps(withHandlers(withHandlers(SelectionOverlay))))) Is there any way I…
machineghost
  • 33,529
  • 30
  • 159
  • 234
3
votes
1 answer

Best practices on order of functs with recompose.pure and recompose.compose

I want to compose (recompose) a React component with recompose.pure and an other hoc. In what order should I do this ? compose(pure, anOtherHoc)(MyComp); compose(anOtherHoc, pure)(MyComp); What is the criterion for deciding this ? import {…
asicfr
  • 1,061
  • 1
  • 13
  • 30
3
votes
1 answer

Recompose - mapProps and withProps not updating prop

I have a container that I'd like to manage the roster sort order, direction and a gender filter. I have tried both withProps and mapProps in the current withProps code below, the roster gets updated correctly inside of withProps, but it doesn't…
azz0r
  • 3,283
  • 7
  • 42
  • 85
3
votes
2 answers

How to get props on recompose lifecycle without using `this`?

I'm using eslint-plugin-immutable so I can't use this keyword (I can eslint-disable-line, but I don't want to), so I'm wondering if there is any way with recompose to access the props inside any of the mount lifecycle, without using the this…
KadoBOT
  • 2,944
  • 4
  • 16
  • 34
2
votes
1 answer

Updating props in Higher Order Components

I'm trying to toggle a radio button and update a prop to what current value it's set on. My Modal component is rendering a RadioButton component as so:
user7496931
  • 1,347
  • 3
  • 15
  • 32
2
votes
2 answers

Why map re rendering on marker click event?

I have google map with multiple markers with the cluster. Upon marker click, I am showing info window, but when I click on marker whole of the map marker and cluster are re-rendered, which makes the page slow and annoying. Following is my…
Gaurav Kumar
  • 1,111
  • 6
  • 25
  • 52
2
votes
0 answers

Unit test error: Field must be inside a component decorated with reduxForm()

I am trying to test my container, but the very first thing it does before even going to the test is this error: 27 | }; 28 | > 29 | const root = mount( | ^ 30 | 31…
user2643810
2
votes
1 answer

How do you read this curry'd function from recompose.. my brain hurts

At my job we use recompose, and we use this kind of curried functions, that to me seem overly complicated and make my brain hurt. Can anyone explain in english how this works? Thanks withStateHandlers(({ readAt, isSender }) => ({ trackVisibility:…
user2643810
2
votes
1 answer

React Native | How access to endCoordinates of Keyboard using Typescript and recompose

So I use recompoose and typescript in my react native app, and I trying to access to endCoordinates for Keyboard the get the Keyboard height. I followed this article and this post but I am not able to access to endCoordinates, it's always…
2
votes
0 answers

How to get a react Refs using recompose?

I need to get a dom reference for a stateless react component during componentDidMount using recompose. I tried to inspect this inside that function bu I cannot get a reference of the dom. I would like to know how to access the dom for that…
GibboK
  • 71,848
  • 143
  • 435
  • 658
2
votes
1 answer

Typescript, React and Recompose issues

Apologies in advance for the vague title it's quite hard to tl;dr my issue. I'm trying to use the React, Recompose and Typescript together but when trying to pass props into my component I get the following error: [ts] Property 'bar' does not exist…
bert
  • 3,989
  • 4
  • 16
  • 32
2
votes
2 answers

Why this doesn't work with recompose and ramda?

In my hoc I have this conditional; branch(R.propSatisfies(R.isEmpty, "repos"), renderComponent(Loader)), // branch(R.isEmpty("repos"), renderComponent(Loader)), What's the difference and why the socond one gives me an error? test is not a…
karolis2017
  • 2,195
  • 8
  • 24
  • 49
2
votes
2 answers

Use recompose to map props consumed from context

I have a functional component that required props height and width to be rendered. Let's call it PureSizableDiv: const PureSizableDiv = ({ height, width }) =>
I'm a div!
I also have a React context called…