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
0
votes
1 answer

Difference between using withStateHandler and withState + withHandler

Does withStateHandler has some benefit over using withState and withHandler together? Why should I use withStateHandler at all when I can get same functionality with withState and withHandler?
mohsen saremi
  • 685
  • 8
  • 22
0
votes
1 answer

How to set loading true in graphql query.?

I am using graphQl in this i want to set loading = true for 1 second to show loader after that it will reset by response how will i do that i am using below code right now, const loadData = graphql(initialData, { options: ({ params: { Id },…
Rituraj ratan
  • 10,260
  • 8
  • 34
  • 55
0
votes
1 answer

higher order function execution

I am confused about higher order functions in recompose. I am playing around with an example in codePen and am not sure why altering the function does not work. I have tried playing in the console but nothing works. const IncreaseHappiness2 =…
olafsadventures
  • 151
  • 1
  • 10
0
votes
1 answer

React Higher Order Components syntax

Overview I am having a hard time understanding the syntax I am finding on the net when it comes to wrapping react components with higher order components in order to access props. The following example (which works) I am to wrapping the component…
Bromox
  • 567
  • 2
  • 9
  • 29
0
votes
1 answer

React - prevent HOC from recomputing based on props

I'm wondering if there's a pattern that allows me to prevent an HOC from recalculating based on some condition, here's an example: const DumbComponent = () =>
Florian Bienefelt
  • 1,448
  • 5
  • 15
  • 28
0
votes
1 answer

testing multiple HOC composed with recompose

I have a setup where I have a main container that is composed with multiple HOC using recompose. The HOC in use are; WithPageWrapper, WithLoading, WithError Composed like this: compose( withPageWrapper, withLoading, …
chinds
  • 1,761
  • 4
  • 28
  • 54
0
votes
1 answer

Recompose with react-navigation - how to hoist static navigation header when using branch?

I have the following using which sets the react-navigation header options. The component is enhanced using various HOC components, and then using Recompose to branch the render logic. When rendering the AuthCallToAction via the renderWhileNoAuth the…
Lee
  • 5,816
  • 6
  • 45
  • 61
0
votes
1 answer

How to change state in a handler

I have a React project and it's using Recompose. Let's say I have a Form, and I supply a 'withHandler' to be used for .. How can I also change the state of the React component when the Form is submitted?
John Doe
  • 113
  • 2
  • 7
0
votes
1 answer

How to rewrite this Textarea Component to recompose?

I have that React Component and I need to rewrite it to recompose. I don't know how to do it correctly. Can you help me? import React, { Component } from "react"; import autosize from "autosize"; class Textarea extends Component { …
0
votes
1 answer

Passing redux state to dispatcher

I'm currently writing a React project (using redux and recompose) and are trying to pass my redux state to my dispatch inside my connect. I'd like to avoid writing my connect code twice, but have had to do so in order to make the currentLocaleCode…
dnlmzw
  • 751
  • 1
  • 8
  • 20
0
votes
1 answer

Perform action when user clicks on map or marker in react-google-maps

I am trying to implement google maps in my react project using react-google-maps package. The map is visible however I am not able to perform other event actions like onClick. The documentation and examples are not useful as they are using…
0
votes
3 answers

RxJS Observable Share startWith() state in merge()

How can I share the startWith(false) state between the 3 streams? I tried using withLatestFrom() but got some weird errors for the value. const Home = componentFromStream(prop$ => { const { handler: toggleHandler, stream: toggle$ } =…
Webber
  • 941
  • 11
  • 26
0
votes
1 answer

How to Execute a Function Inside a Stateless Component for Testing in Jest and Enzyme

I've got a parent component that I've wrapped with Recompose withHandlers HOC. I've got a function called removeGiftHandler that I want to pass down to the child component as a callback that will change the state kept in the props in the parent…
avatarhzh
  • 2,175
  • 4
  • 21
  • 32
0
votes
1 answer

React JS: HOC(Recompose) or Redux

I have to work on React JS application which is currently developed using compose function of Recompose. [https://github.com/acdlite/recompose][1] As per plan to rewrite the Application from Scratch, What is best choice Recompose or…
Muhammad Awais
  • 463
  • 1
  • 6
  • 17
0
votes
2 answers

React Recompose : Method created in WithStateProps is not accessible

I am using Recompose to define some methods like below : export interface WithStateProps { isDisabled: boolean; isReady: boolean; setDisabled(value: boolean): void; setReady(value: boolean): void; } export const withStateHoc =…
Emad Dehnavi
  • 3,262
  • 4
  • 19
  • 44