How to add logic and behavior to components?

Yet another simple question; if I create a page and only want to import specific components from that page into my codebase, is that possible? I’m asking because I’m not sure how to deal with complicated functionality/React state when importing an entire page… I have several form fields and drag&drop components that all need to be handled correctly via React state… Thanks in advance!!! :slightly_smiling_face:

Please let me know if this helps:

Thanks so much for that, @yang! I’m partway through it, now… I’ll try out some of these techniques! :slightly_smiling_face: :pray:

I’m a bit confused… :thinking_face: I’m getting these two errors:

But, I’m pretty sure I’m passing an onChange prop:

And, I’ve got the value linked in the Plasmic interface to the titleInput prop:

@yang I decided to go the codegen route and actually imported the page component. But, I’m not sure how to expose the onChange function for each input… :thinking_face:

My current code looks like this:

I ran the plasmic sync --projects ... command and it generated a folder with my components (I changed the path to plasmicComponents in plasmic.json).

Screen Shot 2022-01-28 at 4.29.54 PM.png

Can you share a link to the project?

Sure! :thumbsup: :slightly_smiling_face:

Are you able to access it?

Your component defines a string prop called titleInput, and passes this in as the value to the title input

In your PlasmicLoader code, you’re passing something into titleInput

I think you mean to override title instead

You can unlink the value from the titleInput prop and just do this (you can play with this from the API Explorer)

Thank you! :pray: :slightly_smiling_face: