Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 1, 2022. It is now read-only.

gorangajic/react-render-to-json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

History

28 Commits

Repository files navigation

react-render-to-json

module to figure out what is passed to this.props.children in react

Build Status

install

npm install react-render-to-json --save

usage example

import React from 'react';
import renderToJson from 'react-render-to-json';
class Heart extends React.Component {
 render() {
 return (
 <svg width="24" fill="#00ea00" height="24" viewBox="0 0 24 24">
 <g><path d="M12 10.375c0-2.416-1.959-4.375-4.375-4.375s-4.375 1.959-4.375 4.375c0 1.127.159 2.784 1.75 4.375l7 5.25s5.409-3.659 7-5.25 1.75-3.248 1.75-4.375c0-2.416-1.959-4.375-4.375-4.375s-4.375 1.959-4.375 4.375"/></g>
 </svg>
 );
 }
}
console.log(renderToJSon(<Heart />));
{
 "name": "Heart",
 "attributes": {},
 "children": [{
 "name": "svg",
 "attributes": {
 "width": "24",
 "fill": "#00ea00",
 "height": "24",
 "viewBox": "0 0 24 24"
 },
 "children": [{
 "name": "g",
 "attributes": {},
 "children": [{
 "name": "path",
 "attributes": {
 "d": "M12 10.375c0-2.416-1.959-4.375-4.375-4.375s-4.375 1.959-4.375 4.375c0 1.127.159 2.784 1.75 4.375l7 5.25s5.409-3.659 7-5.25 1.75-3.248 1.75-4.375c0-2.416-1.959-4.375-4.375-4.375s-4.375 1.959-4.375 4.375"
 }
 }]
 }]
 }]
}

Used by react-svg-morph

Licence

MIT

About

module to figure out what is passed to this.props.children in react

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

AltStyle によって変換されたページ (->オリジナル) /