Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Props passed to <Element is={component} someProp={prop}/> do not update #695

Open
dacapoo opened this issue Aug 22, 2024 · 2 comments
Open

Comments

@dacapoo
Copy link

dacapoo commented Aug 22, 2024

Bug Description:
When passing a prop to a component via the <Element /> component (e.g., <Element is={component} someProp={prop} />), the component initially renders with the correct prop value. However, subsequent updates to the prop in the parent component are not reflected in the child component.

Steps to Reproduce:
Pass a prop to a component using the wrapper.
Update the prop's value in the parent component.
Observe that the child component does not re-render with the updated prop value.

Expected Behavior:
The child component should update when the prop value changes in the parent component.
Is this behavior intentional by design?

Code Example:
A reproduction of this issue can be found in this StackBlitz project: https://stackblitz.com/edit/stackblitz-starters-fzasbl?file=app%2Fpage.tsx

@dacapoo
Copy link
Author

dacapoo commented Sep 2, 2024

any help ? :)

@nikitakofman
Copy link

any help ? :)

Hi, once you set something inside a element , It is the only source of truth. You cannot change the props as you would with react or use state. To do that, you need to use setProp method of craft js.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants