Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Hot Reloading your React App

Julian Valencia
Julian Valencia
10,492 Points

I followed the step of splitting the Scoreboard.js component but I keep losing state whenever I save the .js file

The page reloads after I save Scoreboard.js, so in my local environment this is not working like in the video.

Bernardo Bonança
Bernardo Bonança
10,773 Points

Hi Julian,

What happens when you save the styles? Do you lose the state also? Could you maybe share your webpack config?

Julian Valencia
Julian Valencia
10,492 Points

@bernardobonanca Hi,

When I save the styles I don't lose state.

This is my webpack.congif.js code

module.exports = {

  entry: './app.js',

  output: {
    //path: 'build',
    filename: 'bundle.js'
  },

  module: {
    loaders: [
      {
        test: /\.js$/,
        exclude: /node_modules/,
        loaders: ['react-hot-loader/webpack', 'babel-loader']
      },
      {
        loaders: ["style-loader", "css-loader", "sass-loader"],
        test: /\.scss$/
      }
    ]
  }

}