Get started with aphrodite CDN

MIT licensed

Aphrodite is a React-focused, server-side rendering library for building fast, dynamic web applications.

Tags:
  • css
  • react
  • inline-styles

Stable version

Copied!

How to start using aphrodite CDN


const Aphrodite = require('aphrodite/noop.js'); // Import Aphrodite with noop replacement for process.env.NODE_ENV !== 'production'
const h = require('virtual-h'); // Import virtual-h for creating virtual DOM elements

const App = () => {
  const style = Aphrodite.style({
    color: 'red',
    fontSize: '24px',
  });

  return h('div', null, [
    h('h1', { className: 'title' }, 'Hello, Aphrodite!'),
    h('p', null, 'This is an example using Aphrodite with the provided CDN link.', { style }),
  ]);
};

// Render the component to a string
const html = Aphrodite.add(App).toStaticString();

// Send the HTML string as the response
module.exports = (req, res) => {
  res.send(html);
};
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!

All versions