Giter Site home page Giter Site logo

Comments (5)

beaucollins avatar beaucollins commented on May 11, 2024

Another option is to have a folder of icons whose index.js required and exported each one:

// icons/index.js

import Trash from './trash'
import Back from './back'
import Plus from './plus'

export { Trash, Back, Plus }

Then where you're using them you could import only what you were using:

import { Trash } from './icons'

render() {
   return <Trash />
}

Or reference all of them:

import * as Icons from './icons'

render: function() {
   return <Icons.Trash />
}

from simplenote-electron.

srgpqt avatar srgpqt commented on May 11, 2024

While this can certainly be done, I don't see the benefit?

from simplenote-electron.

beaucollins avatar beaucollins commented on May 11, 2024

I think @drw158 is trying to reduce the amount of characters to type when putting in icons.

from simplenote-electron.

srgpqt avatar srgpqt commented on May 11, 2024

Doesn't seem like much of a benefit. There aren't that many icons per component.

from simplenote-electron.

davewhitley avatar davewhitley commented on May 11, 2024

Yep, the main benefit is reducing the amount of work when creating new components. Instead of searching for the icon you need, looking up the icon name, and then adding an import for each one, you could just import the entire set. Beau's solution would probably be better for long term than what we have now.

It's not a lot of trouble now because we only have a handful of icons, but it's possible that we'll add more. If it becomes cumbersome, we can reopen this issue.

from simplenote-electron.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.