Giter VIP home page Giter VIP logo

react-updating-state-lab's People

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

react-updating-state-lab's Issues

Missing critical information about YouTubeDebugger

The README doesn't indicate this, but in order for the YouTubeDebugger tests to work, you need to wrap the <button>s in a <div> or some other HTML element.

Here's what I did initially (without giving away the whole solution):

render() {
    return ([
      <button></button>,
      <button></button>
    ])
  }

It worked in the Chrome browser, but the test output looked like this:

1) <YouTubeDebugger /> should have the correct initial state:
     Error: Method “state” is meant to be run on 1 node. 2 found instead.
      at ShallowWrapper.single (node_modules/enzyme/src/ShallowWrapper.js:1652:13)
      at ShallowWrapper.state (node_modules/enzyme/src/ShallowWrapper.js:1194:25)
      at Context.<anonymous> (test/index-test.js:55:20)
      at processImmediate (internal/timers.js:456:21)

  2) <YouTubeDebugger /> should update the bitrate when the `.bitrate` button is clicked:
     Error: Method “setState” is meant to be run on 1 node. 2 found instead.
      at ShallowWrapper.single (node_modules/enzyme/src/ShallowWrapper.js:1652:13)
      at ShallowWrapper.setState (node_modules/enzyme/src/ShallowWrapper.js:742:10)
      at YouTubeDebugger.ShallowWrapper.instance.setState (node_modules/enzyme/src/ShallowWrapper.js:422:66)
      at YouTubeDebugger._this.changeBitrate (src/components/YouTubeDebugger.js:21:10)
      at node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:716:13
      at withSetStateAllowed (node_modules/enzyme-adapter-utils/src/Utils.js:99:18)
      at Object.simulateEvent (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:712:11)
      at ShallowWrapper.<anonymous> (node_modules/enzyme/src/ShallowWrapper.js:1134:7)
      at ShallowWrapper.single (node_modules/enzyme/src/ShallowWrapper.js:1654:21)
      at ShallowWrapper.simulate (node_modules/enzyme/src/ShallowWrapper.js:1133:17)
      at Context.<anonymous> (test/index-test.js:63:30)
      at processImmediate (internal/timers.js:456:21)

  3) <YouTubeDebugger /> should update the video resolution when the `.resolution` button is clicked:
     Error: Method “setState” is meant to be run on 1 node. 2 found instead.
      at ShallowWrapper.single (node_modules/enzyme/src/ShallowWrapper.js:1652:13)
      at ShallowWrapper.setState (node_modules/enzyme/src/ShallowWrapper.js:742:10)
      at YouTubeDebugger.ShallowWrapper.instance.setState (node_modules/enzyme/src/ShallowWrapper.js:422:66)
      at YouTubeDebugger._this.changeVideoResolution (src/components/YouTubeDebugger.js:32:10)
      at node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:716:13
      at withSetStateAllowed (node_modules/enzyme-adapter-utils/src/Utils.js:99:18)
      at Object.simulateEvent (node_modules/enzyme-adapter-react-16/src/ReactSixteenAdapter.js:712:11)
      at ShallowWrapper.<anonymous> (node_modules/enzyme/src/ShallowWrapper.js:1134:7)
      at ShallowWrapper.single (node_modules/enzyme/src/ShallowWrapper.js:1654:21)
      at ShallowWrapper.simulate (node_modules/enzyme/src/ShallowWrapper.js:1133:17)
      at Context.<anonymous> (test/index-test.js:73:33)
      at processImmediate (internal/timers.js:456:21)

In order to get the tests passing, I had to wrap the <button> elements in a <div>:

render() {
    return (
      <div>
        <button></button>
        <button></button>
      </div>
    )
  }

As I said above, though, the README doesn't tell us to do this at all.

Thanks, as always, for looking into this!

Sdcrouse

Code snippet incorrect

This component has several state properties. The initial state shape looks like this: js { errors: [], user: null, settings: { bitrate: 8, video: { resolution: '1080p' } } }

Routes to wrong 'Next' lab

Canvas Link

https://learning.flatironschool.com/courses/1883/assignments/125708?module_item_id=259621

Concern

Clicking 'Next' skips over the 'React Controlled Components' code-a-long lab.

Additional Context

Not sure if it is buggy on my end but I refreshed the page and tried it a couple times and it keeps skipping the lab. I didn't realize I skipped it till I completed the lab before the reading and code-a-long.

Suggested Changes

Adjust link so that it connects to the proper lab.

Spread operator

The curriculum states the spread operator is recommended so I think the solution should prioritize that solution, rather than the object.assign().

Also, the solution for updating the digital clicker is MUCH MORE COMPLEX than necessary, and includes life-cycle components, even tho that is 2 sections ahead.
solution should be:
handleClick = () => {
this.setState({
timesClicked: ++ this.state.timesClicked
})
}

Previous State has not been covered

The idea of grabbing information from a previous state hasn't yet been covered in labs. It should be mentioned, at the very least, and preferably covered explicitly in a ReadMe or lab.

npm server - error when try to start server

when use "npm server" server does not start, error messages result. When follow instructions to resolve, does not resolve. Therefore, just used "tests" with no browser feed-back for this lab.

Error when using bundle script

When using npm run bundle or yarn run bundle to execute Browserify script, the following error comes up.

Error: Cannot find module 'react-test-renderer/shallow' from '/Users/stevefrost/Development/react-updating-state-lab-v-000/node_modules/enzyme/build'

This is fixed by adding react-test-renderer as a devDependencies in package.json. I've created a pull request that can be found here if this fixes the issue for you as well.

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.