-
Notifications
You must be signed in to change notification settings - Fork 47k
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
How does react map props to dom internally? #11706
Comments
Does this help? https://reactjs.org/docs/dom-elements.html In general React always uses |
@gaearon yeah, I understand that JSX uses camelCase, but what code in the react library does the mapping of the camelCase props to javascript/dom elements? If you look at the code I've pointed to, its working with real dom nodes, but if there is a way where I can use react instead of the dom, that'd be even better but I'm currently not sure how I could do that. |
There is a mapping between DOM events and names but it's kind of scattered around the library right now, and there's no easy snippet to cut and paste. |
@gaearon can you point me to a few of the files these are defined in? |
Here's some events that get their first letter capitalized with react/packages/react-dom/src/events/SimpleEventPlugin.js Lines 55 to 119 in c78db58
There's more you can find if you search for But there is more. |
@gaearon thanks for the help, quick question. how do you inline code like that in GitHub? or where are the docs that describe that functionality? |
Just paste a link to specific lines and it'll be inlined. You can take a link to specific lines by clicking on the start line in the file source view. (and shift+clicking to choose the end line) |
Hi, I'm working on a library that proxy's SVG elements so you can mutate the SVG Element when it has loaded.
https://github.com/lifeiscontent/react-svg-injector
I noticed that when I added an
onClick
prop to my Mutate component it didn't map properly as in javascript the proper syntax isonclick
.Here is where the code I'm working on lives: https://github.com/lifeiscontent/react-svg-injector/blob/master/lib/mutate.js#L17
I'm wondering how ReactDOM does this internally so I can have a consistent API with my library.
any support on this topic is greatly appreciated, thanks!
The text was updated successfully, but these errors were encountered: