BuilderIO/mitosis

BUG: Mitosis does not camelCase HTML attributes in React

Open

#526 opened on Jun 28, 2022

View on GitHub
 (7 comments) (0 reactions) (1 assignee)TypeScript (411 forks)batch import
coregood first issuereact

Repository metrics

Stars
 (9,803 stars)
PR merge metrics
 (Avg merge 1d 1h) (6 merged PRs in 30d)

Description

Scope

  • This impacts ALL Mitosis outputs
  • This only impacts specific generators/outputs (please list them here): React

Describe the bug Attributes like srcset are camelCased in React (possibly other frameworks? Not sure). However, Mitosis does not account for that

To Reproduce

A link to a https://mitosis.builder.io/ fiddle containing the bug: link

Expected behavior scrset should become srcSet in the React output. Same goes for all HTML attributes that are multi-word: https://reactjs.org/docs/dom-elements.html

Additional context

  • I am not sure what the comprehensive list of camelCased DOM elements is, but we can probably look at React's JSX types to determine what to do
  • I am also not sure if other frameworks do this camelCasing. We might need to do this elsewhere too

Contributor guide