In React's terminology, there are five core types that are important to distinguish:
React Elements
| // util function to convert the input to string type | |
| function convertToString(input) { | |
| if(input) { | |
| if(typeof input === "string") { | |
| return input; | |
| } | |
| // LazyLoad Library: https://github.com/aFarkas/lazysizes | |
| // Usage | |
| <sly data-sly-use.template="/path/to/template/image.html" | |
| data-sly-call="${ template.imageMarkup @ xsvp=image.xsvpPath, svp=image.svpPath, mvp=image.mvpPath, lvp=image.lvpPath, altText=image.altText, lazyLoad=true }" /> | |
| // HTL Template | |
| <template data-sly-template.imageMarkup="${ @ xsvp, svp, mvp, lvp, altText, lazyLoad }"> | |
| <picture> | |
| <source media="(max-width: 480px)" data-srcset="${xsvp}" /> |
| using ICities; | |
| using System; | |
| using System.Reflection; | |
| using UnityEngine; | |
| namespace LightingRebalance | |
| { | |
| public class LightingRebalanceMod : LoadingExtensionBase, IUserMod | |
| { | |
| public string Name | |
| { |
| //---------------------------------------------------------------- | |
| // Prop Variation Amount Changer | |
| //Set amount of prop variations. | |
| //If you are increasing the amount, previous variations will be preserved. | |
| //If decreasing, all variations will be removed! | |
| var variations = 12; //CHANGE THIS |
| // Texture Replacer script by Ronyx69 | |
| // ASSET EDITOR, not ingame | |
| // Replaces textures in asset editor in real time! | |
| // Much thanks to SamsamTS for explaining Actions to me and being helpful. | |
| // D, ACI, XYS textures for buildings, props, vehicles and D, XYCA for trees. | |
| // Unfortunately CANNOT replace LOD textures. | |
| // Technically I know how to replace LOD textures, |
| // Returns first element that matches CSS selector {expr}. | |
| // Querying can optionally be restricted to {container}’s descendants | |
| function $(expr, container) { | |
| return typeof expr === "string"? (container || document).querySelector(expr) : expr || null; | |
| } | |
| // Returns all elements that match CSS selector {expr} as an array. | |
| // Querying can optionally be restricted to {container}’s descendants | |
| function $$(expr, container) { | |
| return [].slice.call((container || document).querySelectorAll(expr)); |
In React's terminology, there are five core types that are important to distinguish:
React Elements