forgojs / forgojs/forgo

Attribute Transformers

Open
#57 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
TypeScript
Stars
321
Forks
10
PR merge metrics
No merged PRs in 30d

Description

Initial discussion at https://github.com/forgojs/forgo/issues/54

Parts of the discussion are copied below for context:

### Initial proposal by @spiffytech

Forgo could allow libraries to implement this if component had a method to modify attributes before they're put onto the DOM. Something like:

```tsx
function someFunc() {
transformAttr(name, value, args) {
if (name.startsWith('on')) {
return autoRedraw(value, args);
}
return value;
},
render() {...}
}
```

Then you could imagine a library exposing this the same way forgo-state accepts a component and returns a component with modified lifecycle methods.

Pair this with wanting click handlers to run inside the component's error boundary and we've got two examples where modifying DOM node attributes is useful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.