Creating your first Cast
This section describes how to create your first Cast component.
Note: Please ensure you have completed the previous step before starting this step.
Add a Cast to an example Dashboard.js
file
Dashboard.js
fileIn this case we want to hide some content from our customer customer@yourclient.com
(assuming in our Typecast platform we have created a UX Change with name
: HideFromManager
, action
: hide
for a User Group
with Trigger
user_type=="manager"
).
Loading note: For the duration of time that the
Cast
is waiting for changes to be loaded (up to 500ms), a loading spinner will appear for the customer, you can pass your own loading component toCasts
if preferred.
Right now this is what our code looks like:
Wrap components desired to be managed through Typecast with a Cast
Adding a Cast
to your components is as easy as wrapping the parts of your component you'd like to manage externally with a Cast
.
It's as simple as that. Now you can create as many Cast
components as you'd like in your codebase!
This completes our installation and first Cast section. There are more powerful ways to use Typecast, such as passing props to your wrapped components dynamically, and managing user state through Typecast. With these features, advanced rendering logic and dynamic content can be added to your product!
Completed Dashboard.js + Cast file overview
Congrats! We've successfully created our first Cast!
A view of our Dashboard.js
component.
Last updated