Skip to content

Instantly share code, notes, and snippets.

View marensas's full-sized avatar

Marius marensas

View GitHub Profile
@marensas
marensas / Hello.tsx
Created April 2, 2018 14:32
Typescript + React
import * as React from 'react';
export interface Props {
name: string;
enthusiasmLevel?: number;
}
function Hello({ name, enthusiasmLevel = 1 }: Props) {
if (enthusiasmLevel <= 0) {
throw new Error('You could be a little more enthusiastic. :D');
@marensas
marensas / App.js
Last active February 1, 2018 10:25
Container
// src/index.js //
import React from 'react';
import { render } from 'react-dom';
import { createStore } from 'redux';
import { Provider } from 'react-redux';
import rootReducer from './reducers';
import App from './containers/App';
const store = createStore(rootReducer);
@marensas
marensas / actions.js
Last active February 1, 2018 15:36
Actions
// src/actions/index.js //
// Paprastas objektas su tipu ir perduodama informacija
export const addInfo = info => ({
type: 'ADD_INFO',
info
});
@marensas
marensas / index.js
Last active February 1, 2018 10:38
Store creation
// src/index.js //
import React from 'react';
import { render } from 'react-dom';
import { createStore } from 'redux';
import rootReducer from './reducers';
// sukuriame duombaze
const store = createStore(rootReducer);
@marensas
marensas / Component.js
Created January 30, 2018 19:53
Komponentas
import React, { Component } from 'react';
class Komponentas extends Component {
constructor(props) {
super(props);
// mini duombaze
this.state = {
data: 'informacija'
}
@marensas
marensas / webpack.config.js
Created January 29, 2018 10:13
Webpack 6
var webpack = require('webpack');
var path = require('path');
var glob = require('glob');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var PurifyCSSPlugin = require('purifycss-webpack');
module.exports = {
entry: './src',
output: {
path: path.resolve(__dirname, './public'),
@marensas
marensas / webpack.config.js
Created January 29, 2018 09:57
Webpack 5
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: './src',
output: {
path: path.resolve(__dirname, './public'),
filename: 'index.js'
},
module: {
@marensas
marensas / index.html
Last active January 29, 2018 09:39
Webpack 4
<!DOCTYPE html>
<html>
<head>
<title>Webpack project</title>
<link rel="stylesheet" type="text/css" href="/style.css">
</head>
<body>
<h1>Webpack projektas</h1>
<script src="/index.js"></script>
@marensas
marensas / package.json
Last active January 29, 2018 09:25
Webpack 3
{
"private": true,
"scripts": {
"dev": "http-server & node_modules/.bin/webpack --watch",
},
"dependencies": {
"http-server": "^0.11.1",
"webpack": "^3.10.0"
}
}
var webpack = require('webpack');
var path = require('path');
module.exports = {
entry: './src',
output: {
path: path.resolve(__dirname, './public'),
filename: 'index.js'
}
}