A user-friendly guide to quickly integrate the Para Modal into a Create React App (CRA) setup using CRACO.
WARNING: Create React App (CRA) has been officially deprecated by Meta. We recommend using Vite or Next.js for new projects. For more details on the deprecation, refer to the CRA deprecation notice
This guide will walk you through the process of integrating the Para Modal into a Create React App (CRA) project that uses CRACO, ensuring a seamless way to manage user authentication and wallets.
If you havenβt already created your React app with CRA, follow the official CRA docs to scaffold a new project. Once youβve set up CRA, you can install and configure CRACO: CRACO docs.
To use Para, you need an API key. This key authenticates your requests to Para services and is essential for integration.
Donβt have an API key yet? Request access to the Developer Portal to create API keys, manage billing, teams, and more.
First, install the Para React SDK and React Query using your preferred package manager:
Para relies on certain Node.js modules that are not available in the browser by default (e.g., crypto
, buffer
,
stream
). Youβll need to configure polyfills via CRACOβs config to ensure those modules work properly.
Install the necessary polyfill packages before updating your configuration:
Then, modify your craco.config.js
:
This configuration ensures that the Para SDK can properly utilize the necessary Node.js modules in your CRA environment.
You can adjust the polyfill configuration based on your specific needs and the requirements of your project. Youβre welcome to use different polyfill packages or modify the fallback settings as needed.
Now that youβve installed the necessary dependencies, letβs set up the Para SDK in your CRA project using the recommended ParaProvider approach.
Create a Providers Component
Create a providers component that will wrap your application with both the QueryClientProvider (required for Para) and the ParaProvider:
Para offers two hosted environments: Environment.BETA
(alias Environment.DEVELOPMENT
) for testing, and
Environment.PROD
(alias Environment.PRODUCTION
) for live use. Select the environment that matches your current
development phase.
Wrap Your App with Providers
Now, wrap your main app component with the Providers component in your index.js
or App.js
:
Add the Para Modal
Now you can include the ParaModal component in any component within your application and use the ParaProvider hooks to control it:
The ParaModal will automatically connect to the ParaProvider context, so you donβt need to pass any additional props for functionality. You only need to customize its appearance.
Beta Testing Credentials In the BETA
Environment, you can use any email ending in @test.getpara.com
(like
dev@test.getpara.com) or US phone numbers (+1) in the format (area code)-555-xxxx
(like (425)-555-1234). Any OTP
code will work for verification with these test credentials. These credentials are for beta testing only. You can
delete test users anytime in the beta developer console to free up user slots.
To provide the best experience for your users, you can customize the appearance of the Para Modal to match your applicationβs branding.
When rendering the ParaModal component, you can pass props to customize its appearance:
For a full list of available ParaModalProps
, refer to the customization guide:
Standalone Para Modal Setup
While the ParaProvider approach is recommended, you can also use the ParaModal as a standalone component. This approach requires you to create and manage a Para client instance manually.
You can create the Para client instance in a dedicated file:
Once you have created your Para client instance, you can integrate the Para Modal into your React component:
This creates a button that, when clicked, opens the Para Modal for user authentication. The Para Modal handles all aspects of user authentication and wallet management.
For practical implementation of the Para SDK in CRACO applications, explore our example repository. This repository contains real-world examples to help you get started.
After integrating Para, you can explore other features and integrations to enhance your Para experience.
If you encounter issues during the integration or usage of the Para Modal in a CRACO-based app, here are some common problems and their solutions:
ParaModal Not Rendering or Not Visible
If the modal isnβt appearing, make sure:
isOpen
state is correctly toggled.ParaModal
component is imported from @getpara/react-sdk
.@alphacraco.config.js
.Modal Appears but Styles Are Missing or Incorrect
If the modalβs styling looks off:
import "@getpara/react-sdk/styles.css@alpha"
.Authentication Fails or API Requests Are Rejected
If youβre experiencing authentication issues:
REACT_APP_PARA_API_KEY
).BETA
or PRODUCTION
) that matches your API key.Polyfill-Related Errors or Undefined Functions
For a more comprehensive list of solutions, visit our troubleshooting guide:
If youβre experiencing issues that arenβt resolved by our troubleshooting resources, please contact our team for assistance. To help us resolve your issue quickly, please include the following information in your request:
1
A detailed description of the problem youβre encountering.
2
Any relevant error messages or logs.
3
Steps to reproduce the issue.
4
Details about your system or environment (e.g., device, operating system, software version).
Providing this information will enable our team to address your concerns more efficiently.