mrbrianevans / social-media-export-analyser

Analyse GDPR exports of your data from big social media companies
https://social-media-export-analyser-mrybc.ondigitalocean.app/
MIT License
1 stars 0 forks source link

Switch to preact for rendering data #31

Open mrbrianevans opened 2 years ago

mrbrianevans commented 2 years ago

Switch from svelte to preact or react to render the data after processing. Can still use svelte for main app, but preact must render in the main section where data is displayed. This is because JSX is required, and typescript support in the dom is required. Svelte doesn't meet those requirements.

Example of need for JSX:

const renderString = (str: string) => {
    if(str.startsWith('https://')) return <a>{str}</a>
    else return <span>{str}</span>
}

Example of need for in-dom typescript support:

interface ComplexObject {
    items: { nested: { name: { firstName: 'joe' } } }[]
}

const renderComplexObject = (obj: ComplexObject) => {
    return <ul>
    {
        obj.items
            .map(i=>i.nested.name)
            .map(n=><li>{n.firstName} {n.lastName}</li>
    }
</ul>
}

When working with many different complex type interfaces, it becomes very difficult when there is no editor support or suggestions when rendering the dom elements. And also no immediate feedback of static typing errors (eg red underline).