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

Kann Beispielen nicht mehr folgen bzw. umsetzen #28

Open
abstract-thinking opened this issue Jul 27, 2020 · 0 comments
Open

Kann Beispielen nicht mehr folgen bzw. umsetzen #28

abstract-thinking opened this issue Jul 27, 2020 · 0 comments

Comments

@abstract-thinking
Copy link

Hallo,

ab Rendering von Elementen kann ich das Beispiel mit React nicht mehr umsetzen.

Das erste Beispiel mit React-JS läuft nicht (ausgeklammert). Das mit reinem JavaScript aber schon. Mir ist nicht klar, was ich falsch gemacht haben soll, da ich die teil von Ab ins kalte Wasser kopiert habe.

<!DOCTYPE html>
<html>

<head>
    <title></title>
</head>

<body>
    <div id="root"></div>
    <script crossorigin src="https://unpkg.com/[email protected]/umd/react.development.js"></script>
    <script crossorigin src="https://unpkg.com/[email protected]/umd/react-dom.development.js"></script>
    <script>
function changeTime() {
  var time = new Date().toLocaleTimeString();
  var target = document.getElementById('root');
  target.textContent = 'Es ist jetzt ' + time + ' Uhr';
}
setInterval(changeTime, 1000);

/*
        function showTime() {
            var time = new Date().toLocaleTimeString();
            var timeElement = (
                <div>
                    <p>Es ist jetzt {time} Uhr</p>
                </div>
            );
            ReactDOM.render(timeElement, document.getElementById('root'));
        }
        setInterval(showTime, 1000);
*/
    </script>

</body>

</html>

Bei einem anderen Beispiel, war die Ausgabe auch schon anders, als im Buch beschrieben

const globalSettings = { language: 'en-US', timezone: 'Berlin/Germany' };
const userSettings = { mutedUsers: ['Manuel'] };
const allSettings = { ...globalSettings, ...userSettings };
console.log(allSettings);

ergab auf meiner Konsole:

{language: 'en-US', timezone: 'Berlin/Germany', mutedUsers: Array(1)}

Gruß,
Markus

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

1 participant