Skip to content

Instantly share code, notes, and snippets.

@vojtatranta
Created March 19, 2017 23:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vojtatranta/ea9fcd3327f1dd689c7b1fefb4647485 to your computer and use it in GitHub Desktop.
Save vojtatranta/ea9fcd3327f1dd689c7b1fefb4647485 to your computer and use it in GitHub Desktop.
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>PHP a JS</title>
</head>
<body>
<h1>Aplikačka</h1>
<div id="app"></div>
</body>
<script>
window.INITIAL_STATE=<?php echo json_encode($template_data) ?>; //tohle je fajn, protože bez použití uvozovek PHP vlastně rovnou vypíše
// js objekt a né jenom JSON string
</script>
<script src="./app.js"/>
</html>
// app.js
// natáhnu si
const store = createStore(reducers, window.INITIAL_STATE) // a redux mi jede se stavem z PHP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment