Ejecting a custom component
Last updated
Last updated
Ejecting a custom component gives you complete control over its code, while still allowing you to use the visual editor for changes. This feature is especially useful for advanced use cases where direct code manipulation is necessary.
When you eject a custom component:
A separate, editable file is generated for the component.
This new file allows you to make custom modifications to the component’s behavior or functionality.
The rest of the canvas remains visually editable in JSX.Design.
Consider ejecting when:
You need individual control over specific instances of a component.
You want to add custom functionality like event handlers or state management.
You aim to integrate external or advanced code logic without disrupting JSX.Design’s auto-generated files.
Follow this step to eject a custom component.
Step 2: Run the below command in your terminal:
Step 3: Select the component you want to eject.
Step 4: JSX.Design generates a new file in the 'ejected-files' folder.
Step 5: Make custom modifications to the component’s behavior or functionality like event handlers or state management in this new file.
Custom component file:
The custom component file remains untouched and reusable.
Ejected file:
The ejected file wraps around the custom component.
Parent file:
The parent file now references the ejected file instead of the custom component.
Code Customization: Add advanced logic, states, and events seamlessly.
Non-Destructive Editing: The visual editor and generated files remain intact.
Reusable Components: Ejected files only affect specific instances, preserving original custom components.
Need any help troubleshooting?
Step 1: Make sure you have successfully exported the code to your React project. .