Coder Social home page Coder Social logo

Comments (9)

bebraw avatar bebraw commented on June 15, 2024

Yeah, a GitHub project would be ideal. I can have a look at this tomorrow.

from react-component-boilerplate.

raphaelparent avatar raphaelparent commented on June 15, 2024

Perfect!

I just pushed everything on github, here's the link.

from react-component-boilerplate.

raphaelparent avatar raphaelparent commented on June 15, 2024

Well I think I found out why, I'm trying to require my component in the src/index.js and it doesn't like that. What I want to do eventually is to push this component on NPM to be used within other projects. Any quick ideas on how to do that?

from react-component-boilerplate.

bebraw avatar bebraw commented on June 15, 2024

Would var Component = require('../Component'); kind of import work? The current expects to find the file from the same directory. Just a quick guess.

Alternatively you could try to develop it below src/ directly (or rename?). I'm not entirely sure what splitting it up between src and component achieves.

from react-component-boilerplate.

raphaelparent avatar raphaelparent commented on June 15, 2024

I was working with the same structure that you have, with demo and src. I'll try that.

from react-component-boilerplate.

raphaelparent avatar raphaelparent commented on June 15, 2024

So yeah this is working, it runs npm run dist without errors.

Another of my concerns is that I can't seem to be able to import css into Component.jsx, the import only works in the component/index.js file. Since I want to export the component has a complete standalone module I want it to work directly in the Component.jsx.

Do you have an idea on how I should modify this to make it work?

from react-component-boilerplate.

bebraw avatar bebraw commented on June 15, 2024

CSS handling is somewhat problematic at the moment. There isn't single right way to handle it. Just see the Styling React chapter of my book to get some idea.

Bundling the style to dist might be a little problematic as we cannot make any assumptions about how our packages are consumed. This is the reason why I like to include a sample CSS file to the project root. You can then import that through Webpack at least if nothing else.

Of course I'm willing to improve the setup if a better solution comes along. For now dealing with styling is a bit messy.

from react-component-boilerplate.

raphaelparent avatar raphaelparent commented on June 15, 2024

Ok perfect, thank you for your time this is really appreciated!

I will go css file at the project root because that seems to be the most logic way to go for now.

from react-component-boilerplate.

bebraw avatar bebraw commented on June 15, 2024

Alright, enjoy. 👍

from react-component-boilerplate.

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.