convert an html file into jsx file
json - React.js - converting JSX to raw HTML string - Stack Overflow
Looking for an Easy Way to Convert React Code to HTML for User Testing
reactjs - How to convert HTML to JSX (React.js) - Stack Overflow
Can I convert a full HTML page to JSX?
What is the difference between JSX and HTML?
What is the difference between HTML and JSX?
), event handlers use camelCase (onClick instead of onclick), and inline styles use JavaScript objects ({ color: 'red' } instead of CSS strings).
I am extremely new to react/nextjs. I went through the nextjs tutorial and it makes sense about react components, but I am so used to html, and plain javascript, that I struggle to understand how I can take existing html files and convert them into jsx.
For example - I was tasked with updating a front end project that used node, and html with templates. (It reminds me of some sort of python jininja templates but its not jininja, I don't know what it is)
Here is the github - https://github.com/datakind/permanent-colandr-front
The html files I want to convert are in the `src/server/routes` folder.
I know how to make components, but how do I make a jsx file from an html file that had a ton of random script stuff inside? Like I wanted to start with the `_base.html` file but most of that has a ton of scripts from external websites. I have the css files added to `_app.js` in the pages folder but I don't know about how to convert anything else.
Here is what the `_base.html` file looks like:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="author" content="">
<title>colandr</title>
<!-- stylesheets -->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<link rel="stylesheet" href="/css/materialize.css">
<link rel="stylesheet" href="/css/main.css">
{% block css %}{% endblock %}
</head>
<body>
{% include './shared/nav.html' %}
<main>
{% block content %}
{% endblock %}
</main>
<!-- vendor scripts -->
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.4.min.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js" integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/nunjucks/3.0.0/nunjucks.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/materialize/0.97.7/js/materialize.min.js"></script>
<script src="/js/templates.js"></script>
{% block footer %}
<footer class='footer'>
<div class='container center'>
<img src='/images/CI+DK.png' height='76px' />
</div>
</footer>
{% endblock %}
<!-- main -->
{% block scripts %}{% endblock %}
</body>
</html>Any suggestions on making that file a jsx file let me know. Thanks!
Hi all,
We're in the process of redeveloping our SaaS app, which is currently built in PHP and HTML, into a more modern stack using Node.js and React. We've built out some new features in React and would like to have our current users (on the old platform) test them before we fully migrate.
However, we're looking for an easy way to convert our React code into a static HTML format so we can integrate it with the legacy system (which is PHP/HTML-based) for user testing purposes. We're not looking to deploy a full React app at this stageโjust want to provide users with a preview of the new features.
Some details:
-
We're using React for the frontend, and the current platform is built using PHP and HTML.
-
The goal is to create a static version (HTML) of our React components for testing, without needing to run a full React app on the current platform.
Is there an easy way or any tools that would help us convert or export our React components as static HTML files?
Thanks for any suggestions!