Accessing Plasmic Studio component data in Next.js

Hi Community,
Is there any way to get plasmic studio’s component data like state variables into a nextjs application?
And would it read the state changes of plasmic studio component in the nextjs app too?

Hi @eligible_roadrunner! Can you explain a little bit your use case? That is possible, but there are different ways to accomplish it and I think it depends on what you’re trying to do, which code components are you using and how they are interacting with studio components.

Hi @tiago
I am making a pricing page which has monthly and yearly subscription details. I am toggling the variant to show the details of the subscription but we are localising the prices. for that I fetching the data from our cms and will substitute the price geographically.

For this i need the value of the state variable which is getting toggled.


Thank you! I think the easiest way to accomplish that is to make a code component that takes the state as a prop and uses it to make the fetching / localization, and instantiate this code component in the studio page. Would that work for you?

This is a different approach. Seems like it will work. Let me try.

Hi @tiago can you share something for reference.

@tiago is there another way to change the state in code (in my nextjs app)? I see that you can access the state via the props object that will be passed in the function of a component, but is there also somewhere a state prop that I can use to manipulate the state in my code?