Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The books chapter on React uses pre version 18 syntax? #27

Open
country-bumpkin-software opened this issue May 9, 2022 · 3 comments
Open

Comments

@country-bumpkin-software

I get a bunch of error messages when running the tests on page 259. I tried to do the following:

import React from "react";
import {App} from "./App.jsx";
import {render} from "react-dom";
import { createRoot } from 'react-dom/client';
import {act} from "react-dom/test-utils"

// @ts-ignore
global.IS_REACT_ACT_ENVIRONMENT = true
const container = document.createElement("div");
let root = createRoot(container)


test('renders the h1 header', () => {
    act(()=> {
      root.render(<App />);
    });
    const header = document.querySelector("h1");
    expect(header.textContent).toBe("Cheesecakes: ")
    
  });

But I get null passed to the header so the test fails.

If you could point me int he right direction that would be awesome.

@srihari-sridharan
Copy link

srihari-sridharan commented May 9, 2022 via email

@country-bumpkin-software
Copy link
Author

is it possible to get any update on this?

@lucasfcosta
Copy link
Owner

Hey John, can you provide some more detail about the error you're seeing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants