DeloitteAU / react-habitat

⚛️ 🛅 A React DOM Bootstrapper designed to harmonise a hybrid 'CMS + React' application.
Other
262 stars 42 forks source link

Update README.md #13

Closed nonewcode closed 7 years ago

nonewcode commented 7 years ago

Add note to let users know html encoded strings are required to be passed in for arrays etc

jennasalau commented 7 years ago

Hey Josh,

Thanks so much for your PR 👍

Your update does explain the gotchya to the readers, however I would like to make some further suggestions before merging if thats okay.

  1. Written is "Passing in an array of objects" but I believe this issue exists for JSON collectively, not just array collections. ie both [{..},{..}] and {..} have the issue
  2. I think we should explain this under a title, something like JSON attributes "best" practice. Currently the underlying issue is HTML attributes can only be strings and JSON properties also has strings (ie nested strings). So i think we should explain that.. I quite like the explanation here.
  3. An alternative is to use single quotes for the html attribute and double quotes for JSON, however not sure if we should suggest that?

Additionally researching this since you raised it, I've noticed all the JSON examples in our readme are technically incorrect. As we are using single quotes in the JSON property names I've since learned this is not following JSON spec. So I will need to update all the examples once we merge this in.

Thanks again for your help, much appreciated.

Jenna