Skip to content

Instantly share code, notes, and snippets.

@kof
Last active April 5, 2016 11:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kof/61b88ca4d1fc0ca5d74dd32897c8d579 to your computer and use it in GitHub Desktop.
Save kof/61b88ca4d1fc0ca5d74dd32897c8d579 to your computer and use it in GitHub Desktop.
React inline style rendering

Rendering a style update

  1. Unset previous props.

Iterate over lastStyle and copy keys into styleUpdates with empty string as a value in order to "unset" them when they are missing in the next style version.

  1. Find modified props.

Iterate over new style and copy modified keys only into styleUpdates.

  1. Render style value

Ensure valid property name and value, add default unit. Set each prop to the node.style object.

@kof
Copy link
Author

kof commented Apr 5, 2016

When is createMarkupForStyles used, first time rendering?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment