question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Implementation in react redux - css not loading

See original GitHub issue

Do you want to request a feature or report a bug? This is probably more about me not integrating correctly in a redux react app ? (Even though I looked at your example and feel I’m doing exactly what you are doing…

What is the current behavior? The Toast css isn’t loaded at all (I need to write the css class myself with position: fixed and z-index: 9999 in order to see it - styleless).

The app has a search bar and I was willing to open a toast when a search starts. The toast is here (in the DOM), but without CSS it is not visible unless I write a custom css class. What I am missing ?

The code :

App.js

import { ToastContainer } from 'react-toastify';
import 'react-toastify/dist/ReactToastify.css';

class App extends React.Component {
  render () {
    return (
      <div>
        <ToastContainer />
       <!-- Other containers -->
      </div>
    );
  }
}

/* Rest of the App.js file */

actions.js

import { toast } from 'react-toastify';

export const UNIFIED_SEARCH_START = 'UNIFIED_SEARCH_START';

export function unifiedSearchStart () {
  toast.success('Unified search start');
  return {
    type: UNIFIED_SEARCH_START,
    payload: true
  };
}

export function unifiedSearch (terms) {
  return dispatch => {
    dispatch(unifiedSearchStart());
    /* do other things here */
  }
}

What is the expected behavior? Was expecting to have the css with this

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React? react 16.3.2 - chrome - MacOS

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

4reactions
bhanushuklacommented, Apr 9, 2019

The import will not work with css-loader in place. You should import it where you have your global css loaded.

I did @import '../node_modules/react-toastify/dist/ReactToastify.min.css'; in my global css so that it is unescaped from CSS modules.

2reactions
boredcitycommented, Jan 25, 2019

added import "react-toastify/dist/ReactToastify.css";. it all works. 😃 sorry to bother about this

Read more comments on GitHub >

github_iconTop Results From Across the Web

Solving the React Error: Not Picking Up CSS Style | Pluralsight
This error is generated because the compiler is only able to import files from the src folder. Here, the CSS file is saved...
Read more >
Why is my CSS not applying to my React components?
Finally, I read an article about 7 ways to apply CSS into React. One best way was to install node-sass into our project...
Read more >
9 Ways To Implement CSS in React JS | by Dmitry Nozhenko
Hey, guys. Today I want to tell you about css in React app. So it was that styles are very important around in...
Read more >
React Stripe.js reference | Stripe Documentation
This doc assumes that you already have a basic working knowledge of React and that you have already set up a React project....
Read more >
Reconciliation - React
This makes writing applications a lot easier, but it might not be obvious how this is implemented within React. This article explains the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found