Answers about react
Questions and answers from the Croct community about react.
Setting custom user attributes from a React component with useCroct
In an onboarding step the user picks their interests and I want to write those onto the profile so later audiences can target them. I already have the values…
useEvaluation for a value, not just a boolean, and a safe default if it fails
Most examples I find use useEvaluation for an on/off flag. I want a component to read an actual value from an evaluation instead, like the visitor's country…
Where in my React tree should I put the CroctProvider?
just installed @croct/plug-react and I am not sure how high up the tree the provider actually needs to be. I have a few routes that read content and one that…
How do I get TypeScript types for the content a slot returns in React?
I am tired of treating slot content as any in my React components. Right now I destructure useContent('home-hero') and TypeScript has no idea what the fields…
Moving off a client-side flag tool to the Croct React SDK, how did it actually feel?
we run our experiments through a client-side flag SDK and keep fighting the flash of the wrong variant before the rules load. Every page briefly shows the…
Strapi backend with a plain React SPA, which Croct SDK and how do I avoid the flash?
our content lives in Strapi and the storefront is a plain React app on Vite, no Next anywhere in the stack. i want to add Croct for personalization but i keep…
How do I pass my own variables into a slot with useContent in React?
the content a slot returns needs to depend on a value my component already has, like the plan tier or a category. I would rather feed that straight into the…
useContent suspends and blanks my whole page, how do I scope the Suspense boundary?
I have a single <Suspense> boundary wrapping the whole page, and every useContent call inside it suspends the entire view until all of the slots resolve. So…
VWO edits on our Storyblok React site keep getting wiped by re-renders
Our marketing team built a couple of tests in VWO's visual editor on our Storyblok-powered React site. The symptom is consistent: the edited headline or…
useContent in our Remix + Sanity app blanks the component then swaps, expected?
We are on Remix 2.15 with @croct/plug-react 2.x, and the hero content is authored in Sanity. I wrapped our Sanity-driven hero in useContent('home-hero')…
Two-person team drowning in self-hosted GrowthBook maintenance, what do React shops actually run?
CTO of a two-person startup. We self-host GrowthBook because it seemed free, and in a sense it is. The Docker stack, the warehouse plumbing, and the…
Moving off client-side flags because of control flash in our React SPA, does a SPA even avoid this?
I do CRO at an agency. We ran an experiment for a client through PostHog feature flags in their React SPA and users visibly got the control for a beat before…