Iggnore node attribute in diff/render. #3539
Unanswered
nicksrandall
asked this question in
Q&A
Replies: 2 comments
-
could do something like
|
Beta Was this translation helpful? Give feedback.
0 replies
-
Preact won't modify or remove any attributes present on an element if they're not present in your JSX (* - see note below). You can use a hook like @JoviDeCroock suggested to remove the JSX prop, or do it manually: const x = <div my-attr="foo" />
if (typeof document !== 'undefined') {
delete x.props['my-attr'];
} * - the one case where it will remove or update attributes is during initial rendering when using the third "replaceNode" argument to render(). In general we don't recommend using that API and would like to remove it in favor of hydrate(). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I know this is a super stange use-case but I'm wondering if it's possible to configure Preact to ignore a certain node attribute when diffing. The idea is that this attribute would be managed by another process so preact should never touch it (ie remove it or reset it). However, I do still need other changes to propagate through to the component so turning off all updates will not work for this use-case.
Beta Was this translation helpful? Give feedback.
All reactions