![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
@automattic/explat-client-react-helpers
Advanced tools
This is the React Interface for the standalone client for Automattic's ExPlat. To be used in conjunction with @automattic/explat-client
, see also the README over there.
<Experiment>
Experiment: (name: string, defaultExperience, treatmentExperience, loadingExperience) => JSX.Element
<Experiment
name="experiment_name"
defaultExperience={ <DefaultComponent /> }
treatmentExperience={ <TreatmentComponent /> }
loadingExperience={ <LoadingComponent /> }
// Optional: See ExperimentOptions
options={experimentOptions}
/>;
useExperiment('experiment_name')
useExperiment: (experimentName: string) => [boolean, ExperimentAssignment | null]
const [ isLoadingExperimentAssignment, experimentAssignment ] = useExperiment( 'experiment_name' );
if ( isLoadingExperimentAssignment ) {
// Show loading experience
} else if ( experimentAssignment?.variationName === 'treatment' ) {
// Provide treatment experience
} else {
// Provide default experience
}
loadExperimentAssignment('experiment_name')
to prefetch an experiment.useExperiment
, <Experiment>
and <ProvideExperimentData>
also takes an options object:
options.isEligible: Boolean = true
Use this to add an in-code eligibility check to whether you want to load an experiment, if false it will return isLoading = false && experimentAssignment = null
which (if you use the above example if-statement or the <Experiment>
or <ProvideExperimentData>
components) should cause the default/fallback experience to show.
It is up to you to ensure that the eligibility checks are consistent, the first eligible experiment will cause an assignment. This parameter can intuitively vary as expected for a hook or component argument, meaning that you can have the isEligible
check be dynamic.
Example usage:
const [ isLoadingExperimentAssignment, experimentAssignment ] = useExperiment( 'experiment_name', { isEligible: flow === 'launch-site' } );
<ProvideExperimentData>
ProvideExperimentData: (name: string, children) => JSX.Element
<ProvideExperimentData
name="experiment_name"
// Optional: See ExperimentOptions
options={experimentOptions}
>
{(isLoading, experimentAssignment) => /* Your code here */}
</ProvideExperimentData>
useExperiment
but available where hooks aren't, use useExperiment
where available.FAQs
Standalone ExPlat Client: React Helpers.
The npm package @automattic/explat-client-react-helpers receives a total of 3,570 weekly downloads. As such, @automattic/explat-client-react-helpers popularity was classified as popular.
We found that @automattic/explat-client-react-helpers demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 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.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.